init
This commit is contained in:
commit
303438d206
217 files changed
+66681
No files matched your search
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Сообщение об ошибке (RU)
|
||||
about: Сообщить о воспроизводимой проблеме toolkit без приватных данных
|
||||
title: "[Bug] "
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
<a id="safety-check"></a>
|
||||
## Проверка безопасности
|
||||
|
||||
[English](bug_report.md) | Русский
|
||||
|
||||
Не публикуйте credentials, приватные адреса, профили оператора, настоящие flags, traffic, raw logs или конфиденциальные исходники. При проблеме безопасности прочитайте [SECURITY.md](../../SECURITY-RU.md) до отправки публичного сообщения.
|
||||
|
||||
<a id="expected-and-actual-behavior"></a>
|
||||
## Ожидаемое и фактическое поведение
|
||||
|
||||
Опишите задуманный результат команды и то, что произошло вместо него. Статическая находка — сигнал для review, а не доказательство эксплуатируемости сервиса.
|
||||
|
||||
<a id="reproduction"></a>
|
||||
## Воспроизведение
|
||||
|
||||
Приведите минимальный синтетический пример, точную очищенную команду, exit code и ограниченный очищенный текст ошибки. Укажите, был ли это preview или явно применённое действие. Не запускайте destructive tests только ради воспроизведения issue.
|
||||
|
||||
<a id="environment"></a>
|
||||
## Окружение
|
||||
|
||||
- Commit/version DurkaHelper:
|
||||
- OS и архитектура:
|
||||
- Версии Python и ripgrep:
|
||||
- Только для deployment: версии Docker/Compose и архитектура image:
|
||||
- Последний известный рабочий commit, если известен:
|
||||
|
||||
<a id="scope-and-recovery"></a>
|
||||
## Область и восстановление
|
||||
|
||||
Что было затронуто? Сработал ли документированный ограниченный rollback? Укажите, относится ли проблема к native core, synthetic fixture или сопровождаемому deployment.
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Report a reproducible toolkit problem without private data
|
||||
title: "[Bug] "
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
English | [Русский](bug_report-RU.md)
|
||||
|
||||
## Safety check
|
||||
|
||||
Do not post credentials, private addresses, operator profiles, real flags,
|
||||
traffic, raw logs or confidential source. For a security issue, read
|
||||
[SECURITY.md](../../SECURITY.md) before submitting a public report.
|
||||
|
||||
## Expected and actual behavior
|
||||
|
||||
Describe the command's intended result and what happened instead. A static
|
||||
finding is a review signal, not proof that a service is exploitable.
|
||||
|
||||
## Reproduction
|
||||
|
||||
Provide the smallest synthetic example, exact sanitized command, exit code and
|
||||
bounded sanitized error. State whether this was a preview or an explicitly
|
||||
applied action. Do not run destructive tests just to reproduce an issue.
|
||||
|
||||
## Environment
|
||||
|
||||
- DurkaHelper commit/version:
|
||||
- OS and architecture:
|
||||
- Python and ripgrep versions:
|
||||
- For deployment only: Docker/Compose versions and image architecture:
|
||||
- Last known working commit, if known:
|
||||
|
||||
## Scope and recovery
|
||||
|
||||
What was affected? Did the documented scoped rollback work? State whether the
|
||||
problem concerns native core, a synthetic fixture or the maintained deployment.
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: Ложное срабатывание или пропуск сканера (RU)
|
||||
about: Улучшить детектор с помощью небольшого синтетического примера
|
||||
title: "[Scanner] RULE-ID: "
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
<a id="rule-and-environment"></a>
|
||||
## Правило и окружение
|
||||
|
||||
[English](false_positive.md) | Русский
|
||||
|
||||
- Rule ID и commit/version сканера:
|
||||
- Версия language/runtime:
|
||||
- Detection engine, если известен:
|
||||
- Context schema и относящаяся к проблеме настройка приоритета без секретов, если есть:
|
||||
|
||||
<a id="minimal-synthetic-example"></a>
|
||||
## Минимальный синтетический пример
|
||||
|
||||
Приведите код, который можно публиковать. Удалите реальные credentials, identifiers, приватные адреса и чужие исходники. Не прикладывайте полный scan report или настоящий репозиторий, если достаточно небольшого примера.
|
||||
|
||||
<a id="expected-result-and-reasoning"></a>
|
||||
## Ожидаемый результат и обоснование
|
||||
|
||||
Объясните, должно ли правило срабатывать на примере и почему. Добавьте противоположный безопасный или небезопасный пример и соответствующее документированное ограничение детектора. Для проблем aliasing или shadowing включите окружающие binding statements.
|
||||
|
||||
<a id="reproduction-and-proposed-coverage"></a>
|
||||
## Воспроизведение и предлагаемое покрытие
|
||||
|
||||
Укажите очищенную команду и наблюдаемые rule IDs/exit code. Предложите независимые positive и negative tests; не ограничивайтесь изменением regex. Проблемы безопасности в самом toolkit описываются согласно [SECURITY.md](../../SECURITY-RU.md).
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
name: Scanner false positive or false negative
|
||||
about: Improve a detector using a small synthetic example
|
||||
title: "[Scanner] RULE-ID: "
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
English | [Русский](false_positive-RU.md)
|
||||
|
||||
## Rule and environment
|
||||
|
||||
- Rule ID and scanner commit/version:
|
||||
- Language/runtime version:
|
||||
- Detection engine, if known:
|
||||
- Context schema and relevant non-secret priority setting, if any:
|
||||
|
||||
## Minimal synthetic example
|
||||
|
||||
Include code that may be published. Remove real credentials, identifiers,
|
||||
private addresses and source owned by others. Do not attach a full scan report
|
||||
or real repository when a small example will do.
|
||||
|
||||
## Expected result and reasoning
|
||||
|
||||
Explain whether the example should match and why. Include a contrasting safe or
|
||||
unsafe case and the relevant documented detector limitation. For aliasing or
|
||||
shadowing issues, include the surrounding binding statements.
|
||||
|
||||
## Reproduction and proposed coverage
|
||||
|
||||
Give the sanitized command and observed rule IDs/exit code. Suggest independent
|
||||
positive and negative tests; do not rely only on changing a regex. Security
|
||||
issues in the toolkit itself follow [SECURITY.md](../../SECURITY.md).
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: Запрос нового правила обнаружения (RU)
|
||||
about: Предложить ограниченный сигнал для review с независимыми тестами
|
||||
title: "[Rule request] "
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
<a id="family-languages-and-existing-coverage"></a>
|
||||
## Семейство, языки и существующее покрытие
|
||||
|
||||
[English](rule_request.md) | Русский
|
||||
|
||||
Укажите семейство безопасности, затронутые формы языка/API и подходящий CWE, если применимо. С какими существующими правилами есть пересечение? Предпочитайте расширение поддерживаемого детектора дублированию сигнала или увеличению рекламного счётчика правил.
|
||||
|
||||
<a id="detectable-shape-and-limits"></a>
|
||||
## Обнаруживаемая форма и ограничения
|
||||
|
||||
Опишите точный локальный синтаксис, который можно обнаружить без исполнения кода, сетевого доступа или новых core dependencies. Отделяйте deployment risks от подтверждённых уязвимостей. Перечислите случаи, требующие ручного, межпроцедурного review или проверки бизнес-логики.
|
||||
|
||||
<a id="independent-examples"></a>
|
||||
## Независимые примеры
|
||||
|
||||
Для каждой заявленной формы приведите как минимум два независимо написанных положительных и два безопасных/context-negative синтетических примера. Где применимо, включите comments, strings, одноимённые пользовательские функции, alias rebinding и более безопасные альтернативы.
|
||||
|
||||
<a id="remediation-and-sources"></a>
|
||||
## Исправление и источники
|
||||
|
||||
Объясните безопасное исправление с сохранением поведения service/checker и способ его проверки. Дайте ссылки на авторитетную документацию языка/API. Не отправляйте приватный игровой код, flags, secrets, logs или traffic. См. [участие в разработке](../../CONTRIBUTING-RU.md).
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
name: Detection rule request
|
||||
about: Propose a bounded review signal with independent tests
|
||||
title: "[Rule request] "
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
English | [Русский](rule_request-RU.md)
|
||||
|
||||
## Family, languages and existing coverage
|
||||
|
||||
State the security family, affected language/API forms and relevant CWE when
|
||||
applicable. Which existing rules overlap? Prefer extending a supported detector
|
||||
to duplicating a signal or increasing a headline rule count.
|
||||
|
||||
## Detectable shape and limits
|
||||
|
||||
Describe the exact local syntax that can be detected without executing code,
|
||||
network access or new core dependencies. Separate deployment risks from confirmed
|
||||
vulnerabilities. List cases that require manual, interprocedural or business-logic
|
||||
review.
|
||||
|
||||
## Independent examples
|
||||
|
||||
Provide at least two independently written positive and two safe/context-negative
|
||||
synthetic examples for each claimed form. Include comments, strings, same-name
|
||||
user functions, alias rebinding and safer alternatives where relevant.
|
||||
|
||||
## Remediation and sources
|
||||
|
||||
Explain a safe fix that preserves service/checker behavior and how to test it.
|
||||
Link authoritative language/API documentation. Do not submit private competition
|
||||
code, flags, secrets, logs or traffic. See [contributing](../../CONTRIBUTING.md).
|
||||
@@ -0,0 +1,28 @@
|
||||
<a id="outcome-and-scope"></a>
|
||||
## Результат и область изменений
|
||||
|
||||
[English](PULL_REQUEST_TEMPLATE.md) | Русский
|
||||
|
||||
Опишите видимый пользователю результат, сохранённую совместимость и явные ограничения. Ссылайтесь на issues, не копируя приватные данные оператора.
|
||||
|
||||
<a id="verification"></a>
|
||||
## Проверки
|
||||
|
||||
- [ ] Запущены targeted tests и полный локальный suite; указаны точные результаты/skips.
|
||||
- [ ] Сохранены поведение CLI `0/1/2`, read-only defaults и сопоставимость scope.
|
||||
- [ ] У новых и изменённых правил есть независимые positive/negative cases и честно описанные ограничения.
|
||||
- [ ] Проходят проверки счётчиков каталога, стабильных anchors, локальных ссылок, английского текста и парных русских переводов; команды и примеры остаются идентичными.
|
||||
- [ ] Не добавлены исполнение цели, скрытый сетевой доступ или раскрытие секретов.
|
||||
- [ ] Изменения требуют разрешения, проверяют ownership и имеют ограниченный rollback.
|
||||
- [ ] Offline packaging и publication checks охватывают изменённые материалы.
|
||||
- [ ] Закреплённые версии сторонних исходников и образов, происхождение и лицензии остаются явными.
|
||||
|
||||
<a id="platform-and-evidence-boundaries"></a>
|
||||
## Платформы и границы свидетельств
|
||||
|
||||
Перечислите точные commits, platforms и выполненные tests. Невыполненные сценарии Mac, Docker Desktop, физических клиентов, непрерывного захвата и offline start отметьте NOT_RUN или BLOCKED. Не переносите на них выводы из синтетических Linux-проверок.
|
||||
|
||||
<a id="release-and-safety"></a>
|
||||
## Релиз и безопасность
|
||||
|
||||
Опишите требования migration/rollback, нерешённые условия релиза и действия оператора. Подтвердите отсутствие приватных endpoints, credentials, raw logs или PCAP в diff, предназначенной для публикации истории, screenshots, artifacts и обсуждении. Сообщение об уязвимости следует [SECURITY.md](../SECURITY-RU.md), а не публичной демонстрации эксплойта.
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
English | [Русский](PULL_REQUEST_TEMPLATE-RU.md)
|
||||
|
||||
## Outcome and scope
|
||||
|
||||
Describe the user-visible result, preserved compatibility and explicit limits.
|
||||
Link issues without copying private operator data.
|
||||
|
||||
## Verification
|
||||
|
||||
- [ ] Targeted tests and the full local suite were run; exact results/skips are listed.
|
||||
- [ ] CLI `0/1/2` behavior, read-only defaults and scope comparability are preserved.
|
||||
- [ ] New/changed rules have independent positive/negative cases and honest limits.
|
||||
- [ ] Catalog counts, stable anchors, local links, English prose and paired Russian translation checks pass; commands/examples stay identical.
|
||||
- [ ] No target execution, hidden network access or expanded secrets were added.
|
||||
- [ ] Mutations require approval, validate ownership and have scoped rollback.
|
||||
- [ ] Offline packaging and publication checks cover the changed material.
|
||||
- [ ] Third-party source/image pins, provenance and licenses remain explicit.
|
||||
|
||||
## Platform and evidence boundaries
|
||||
|
||||
List exact commits, platforms and tests performed. Mark unexecuted Mac,
|
||||
Docker Desktop, physical-client, continuous-capture and offline-start scenarios
|
||||
NOT_RUN or BLOCKED. Do not promote synthetic/Linux evidence into those claims.
|
||||
|
||||
## Release and safety
|
||||
|
||||
Document migration/rollback needs, unresolved release gates and operator actions.
|
||||
Confirm that diff, history selected for publication, screenshots, artifacts and
|
||||
discussion contain no private endpoints, credentials, raw logs or PCAP. A
|
||||
vulnerability report follows [SECURITY.md](../SECURITY.md), not a public exploit
|
||||
demonstration.
|
||||
@@ -0,0 +1,208 @@
|
||||
name: macOS ARM64 validation
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
synthetic_pcap_base64:
|
||||
description: Optional closed synthetic PCAP (base64, <=32 KiB; never real traffic)
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: macos-arm64-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
name: macOS 15 ARM64 / Python 3.10.11
|
||||
runs-on: macos-15
|
||||
timeout-minutes: 15
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
env:
|
||||
PYTHONUTF8: "1"
|
||||
PYTHONDONTWRITEBYTECODE: "1"
|
||||
steps:
|
||||
- name: Require an ARM64 runner
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test "$(uname -m)" = "arm64"
|
||||
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python 3.10.11 ARM64
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: "3.10.11"
|
||||
architecture: arm64
|
||||
check-latest: false
|
||||
|
||||
- name: Install pinned ripgrep ARM64 in the job directory
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rg_root="ripgrep-15.1.0-aarch64-apple-darwin"
|
||||
rg_dir="$(mktemp -d "$RUNNER_TEMP/durkahelper-ripgrep.XXXXXX")"
|
||||
curl --fail --silent --show-error --location --proto '=https' \
|
||||
--connect-timeout 10 --max-time 120 --retry 2 --max-filesize 5242880 \
|
||||
--output "$rg_dir/release.tar.gz" \
|
||||
"https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/$rg_root.tar.gz"
|
||||
python -c 'import hashlib, pathlib, sys; archive = pathlib.Path(sys.argv[1]); assert archive.stat().st_size <= 5242880; assert hashlib.sha256(archive.read_bytes()).hexdigest() == "378e973289176ca0c6054054ee7f631a065874a352bf43f0fa60ef079b6ba715", "ripgrep release checksum mismatch"' "$rg_dir/release.tar.gz"
|
||||
tar -xzf "$rg_dir/release.tar.gz" -C "$rg_dir" "$rg_root/rg"
|
||||
test -x "$rg_dir/$rg_root/rg"
|
||||
"$rg_dir/$rg_root/rg" --version
|
||||
printf '%s\n' "$rg_dir/$rg_root" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Verify runtime prerequisites
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python -c 'import platform, sys; assert sys.version_info[:3] == (3, 10, 11), sys.version; assert platform.machine() == "arm64", platform.machine()'
|
||||
command -v rg
|
||||
rg --version
|
||||
python -c 'import subprocess; import re; version = subprocess.check_output(["rg", "--version"], text=True).splitlines()[0]; assert re.fullmatch(r"ripgrep 15\.1\.0(?: \(rev [0-9a-f]+\))?", version), version'
|
||||
|
||||
- name: Run Defense unit tests
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python -m unittest discover -s tests -p 'test_*.py' -v 2>&1 | tee "$RUNNER_TEMP/unittest.log"
|
||||
if rg -n ' \.\.\. skipped |^OK \(skipped=' "$RUNNER_TEMP/unittest.log"; then
|
||||
echo "macOS acceptance forbids skipped tests" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Smoke-test current command-line tools
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
test "$(python -X utf8 -I -S scripts/defense_scan.py --version)" = "1.8.0"
|
||||
test "$(python -X utf8 -I -S scripts/defense_ops.py --version)" = "2.2.0"
|
||||
# http_probe imports the adjacent, tracked common.py helper.
|
||||
python -X utf8 -E -s -S scripts/http_probe.py --help > /dev/null
|
||||
python -X utf8 -I -S scripts/defense_diff.py --help > /dev/null
|
||||
python -X utf8 -I -S durka.py --help > /dev/null
|
||||
python -X utf8 -I -S durka.py doctor --help > /dev/null
|
||||
# Hosted CI has no prepared Desktop stack/config/client. BLOCKED is
|
||||
# expected; only the actual native host and sanitized report are checked.
|
||||
set +e
|
||||
python -X utf8 -I -S durka.py doctor --json > "$RUNNER_TEMP/doctor.json"
|
||||
doctor_status=$?
|
||||
set -e
|
||||
test "$doctor_status" -eq 2
|
||||
python -c 'import json, sys; data = json.load(open(sys.argv[1], encoding="utf-8")); checks = {r["check"]: r["status"] for r in data["checks"]}; assert data["read_only"] is True and data["competition_ready"] is False; assert checks["macOS ARM64"] == "READY" and checks["Python"] == "READY"; assert data["status"] == "BLOCKED"' "$RUNNER_TEMP/doctor.json"
|
||||
python -X utf8 -I -S scripts/log_summary.py --help > /dev/null
|
||||
python -X utf8 -I -S scripts/backup_config.py --help > /dev/null
|
||||
python -X utf8 -I -S scripts/toolchain_bundle.py --help > /dev/null
|
||||
python -X utf8 -I -S scripts/toolchain_inventory.py --help > /dev/null
|
||||
python -X utf8 -I -S deployment/recovery_activation.py --help > /dev/null
|
||||
python -X utf8 -I -S deployment/packmate_host.py --help > /dev/null
|
||||
python -X utf8 -I -S deployment/packmate_file.py --help > /dev/null
|
||||
python -X utf8 -I -S deployment/toolkit.py --help > /dev/null
|
||||
python -X utf8 -I -S scripts/scanner_coverage.py --check
|
||||
python -X utf8 -I -S scripts/publication_check.py --allowlist config/publication-allowlist.json
|
||||
|
||||
python -X utf8 -I -S scripts/defense_scan.py --list-rules > "$RUNNER_TEMP/rules.txt"
|
||||
python -c 'import pathlib, sys; assert len(pathlib.Path(sys.argv[1]).read_text(encoding="utf-8").splitlines()) == 174' "$RUNNER_TEMP/rules.txt"
|
||||
|
||||
python -X utf8 -I -S scripts/defense_scan.py --explain PY-EVAL > "$RUNNER_TEMP/explain.json"
|
||||
python -c 'import json, sys; data = json.load(open(sys.argv[1], encoding="utf-8")); assert data["id"] == "PY-EVAL"' "$RUNNER_TEMP/explain.json"
|
||||
|
||||
set +e
|
||||
python -X utf8 -I -S scripts/defense_scan.py lab --context config/scanner-context.example.json --json > "$RUNNER_TEMP/scan.json"
|
||||
scan_status=$?
|
||||
set -e
|
||||
test "$scan_status" -eq 0 || test "$scan_status" -eq 1
|
||||
python -c 'import json, sys; data = json.load(open(sys.argv[1], encoding="utf-8")); assert data["tool"] == "DurkaHelper defense_scan"; assert data["offline"] is True; assert data["partial"] is False' "$RUNNER_TEMP/scan.json"
|
||||
|
||||
python -X utf8 -I -S scripts/defense_diff.py "$RUNNER_TEMP/scan.json" "$RUNNER_TEMP/scan.json" --json > "$RUNNER_TEMP/diff.json"
|
||||
python -c 'import json, sys; data = json.load(open(sys.argv[1], encoding="utf-8")); assert data["tool"] == "DurkaHelper defense_diff"; assert data["exit_code"] == 0' "$RUNNER_TEMP/diff.json"
|
||||
|
||||
ops_dir="$RUNNER_TEMP/defense-ops-source"
|
||||
mkdir -p "$ops_dir"
|
||||
python -X utf8 -I -S scripts/defense_ops.py preflight \
|
||||
--profile config/defense-profile.example.json > "$ops_dir/preflight.json"
|
||||
python -X utf8 -I -S scripts/defense_ops.py snapshot \
|
||||
--profile config/defense-profile.example.json \
|
||||
--root . \
|
||||
--output "$ops_dir/snapshot.json" > "$ops_dir/snapshot-command.json"
|
||||
python -X utf8 -I -S scripts/defense_ops.py compare \
|
||||
"$ops_dir/snapshot.json" "$ops_dir/snapshot.json" > "$ops_dir/comparison.json"
|
||||
python -c 'import json, pathlib, sys; root = pathlib.Path(sys.argv[1]); preflight = json.loads((root / "preflight.json").read_text(encoding="utf-8")); snapshot = json.loads((root / "snapshot.json").read_text(encoding="utf-8")); comparison = json.loads((root / "comparison.json").read_text(encoding="utf-8")); assert preflight["exit_code"] == 0 and preflight["partial"] is False; assert snapshot["partial"] is False; assert comparison["exit_code"] == 0 and comparison["comparable"] is True and comparison["summary"]["drift_count"] == 0' "$ops_dir"
|
||||
|
||||
- name: Exercise synthetic Vulnbox file handoff and Docker review
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# Read event JSON in Python, never interpolate input into shell code.
|
||||
# No SSH, private VM connection, Docker runtime or capture privileges.
|
||||
python -X utf8 -I -S integration/vulnbox_handoff.py --event "$GITHUB_EVENT_PATH"
|
||||
|
||||
- name: Build and smoke-test required offline bundle
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
test -f scripts/build_offline_bundle.py
|
||||
bundle="$RUNNER_TEMP/durkahelper-offline.tar.gz"
|
||||
extract_dir="$RUNNER_TEMP/durkahelper-offline"
|
||||
python scripts/build_offline_bundle.py --output "$bundle"
|
||||
test -s "$bundle"
|
||||
python scripts/build_offline_bundle.py --verify "$bundle"
|
||||
|
||||
mkdir -p "$extract_dir"
|
||||
tar -xzf "$bundle" -C "$extract_dir"
|
||||
scanner_path="$(python -c 'import pathlib, sys; paths = list(pathlib.Path(sys.argv[1]).rglob("scripts/defense_scan.py")); assert len(paths) == 1, paths; print(paths[0])' "$extract_dir")"
|
||||
bundle_root="$(python -c 'import pathlib, sys; print(pathlib.Path(sys.argv[1]).resolve().parents[1])' "$scanner_path")"
|
||||
|
||||
test -f "$bundle_root/rules/defense.json"
|
||||
(
|
||||
cd "$bundle_root"
|
||||
test ! -e .git
|
||||
python -m unittest discover -s tests -p 'test_*.py' -v 2>&1 | tee "$RUNNER_TEMP/bundle-unittest.log"
|
||||
if rg -n ' \.\.\. skipped |^OK \(skipped=' "$RUNNER_TEMP/bundle-unittest.log"; then
|
||||
echo "macOS offline-bundle acceptance forbids skipped tests" >&2
|
||||
exit 1
|
||||
fi
|
||||
test "$(python -X utf8 -I -S scripts/defense_scan.py --version)" = "1.8.0"
|
||||
test "$(python -X utf8 -I -S scripts/defense_ops.py --version)" = "2.2.0"
|
||||
python -X utf8 -I -S scripts/scanner_coverage.py --check
|
||||
python -X utf8 -I -S scripts/defense_scan.py --list-rules > "$RUNNER_TEMP/bundle-rules.txt"
|
||||
python -c 'import pathlib, sys; assert len(pathlib.Path(sys.argv[1]).read_text(encoding="utf-8").splitlines()) == 174' "$RUNNER_TEMP/bundle-rules.txt"
|
||||
|
||||
bundle_ops_dir="$RUNNER_TEMP/defense-ops-bundle"
|
||||
mkdir -p "$bundle_ops_dir"
|
||||
python -X utf8 -I -S scripts/defense_ops.py preflight \
|
||||
--profile config/defense-profile.example.json > "$bundle_ops_dir/preflight.json"
|
||||
python -X utf8 -I -S scripts/defense_ops.py snapshot \
|
||||
--profile config/defense-profile.example.json \
|
||||
--root . \
|
||||
--output "$bundle_ops_dir/snapshot.json" > "$bundle_ops_dir/snapshot-command.json"
|
||||
python -X utf8 -I -S scripts/defense_ops.py compare \
|
||||
"$bundle_ops_dir/snapshot.json" "$bundle_ops_dir/snapshot.json" > "$bundle_ops_dir/comparison.json"
|
||||
python -c 'import json, pathlib, sys; root = pathlib.Path(sys.argv[1]); preflight = json.loads((root / "preflight.json").read_text(encoding="utf-8")); snapshot = json.loads((root / "snapshot.json").read_text(encoding="utf-8")); comparison = json.loads((root / "comparison.json").read_text(encoding="utf-8")); assert preflight["exit_code"] == 0 and preflight["partial"] is False; assert snapshot["partial"] is False; assert comparison["exit_code"] == 0 and comparison["comparable"] is True and comparison["summary"]["drift_count"] == 0' "$bundle_ops_dir"
|
||||
)
|
||||
|
||||
- name: Record validation evidence
|
||||
if: ${{ always() }}
|
||||
env:
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: |
|
||||
architecture="$(uname -m)"
|
||||
python_version="$(python --version 2>&1 || true)"
|
||||
ripgrep_version="$(rg --version 2>/dev/null | head -n 1 || true)"
|
||||
{
|
||||
echo '## macOS ARM64 validation evidence'
|
||||
echo
|
||||
echo '| Field | Value |'
|
||||
echo '|---|---|'
|
||||
printf '| Run | [%s](%s) |\n' "$GITHUB_RUN_ID" "$RUN_URL"
|
||||
printf '| Commit | `%s` |\n' "$GITHUB_SHA"
|
||||
printf '| Architecture | `%s` |\n' "$architecture"
|
||||
printf '| Python | `%s` |\n' "${python_version:-unavailable}"
|
||||
printf '| ripgrep | `%s` |\n' "${ripgrep_version:-unavailable}"
|
||||
printf '| Runner image | `%s` / `%s` |\n' "${ImageOS:-unknown}" "${ImageVersion:-unknown}"
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
Reference in new issue
Block a user