test(security): verify full lifecycle and audit clean-clone private material

This commit is contained in:
2026-11-20 20:09:13 +03:00
parent 5c91f605fb
commit 0061722f93
7 changed files with 158 additions and 5 deletions
+36
View File
@@ -97,6 +97,11 @@ def main():
output = ROOT / args.output
if output.exists():
raise SystemExit("Choose new output path")
for name in ["pki-research-final.json", "pki-research-final-requests.csv"]:
if (ROOT / "evidence" / name).exists():
raise SystemExit(
"Retain the existing research receipt under a distinct name before a fresh full run"
)
assert not subprocess.check_output(
["git", "status", "--porcelain"], cwd=ROOT
)
@@ -271,6 +276,31 @@ def main():
receipt["cluster"] = json.loads(
(clone / "evidence/clean-cluster.json").read_text()
)
run(
[
".venv/bin/python",
"-m",
"scripts.research_security",
"--output",
"evidence/pki-research-final.json",
],
cwd=clone,
env=env,
)
receipt["security_research"] = json.loads(
(clone / "evidence/pki-research-final.json").read_text()
)
for name in [
"pki-research-final.json",
"pki-research-final-requests.csv",
]:
destination = ROOT / "evidence" / name
assert not destination.exists(), (
"Choose a fresh research receipt path"
)
destination.write_text(
redact((clone / "evidence" / name).read_text(), clone)
)
import hashlib
expected = {
@@ -326,6 +356,11 @@ def main():
receipt["fsck"] = run(
["git", "fsck", "--full"], cwd=clone, env=env
)
receipt["private_material_audit"] = run(
[".venv/bin/python", "-m", "scripts.audit_secrets"],
cwd=clone,
env=env,
)
receipt["checks_completed"] = True
except BaseException:
receipt["partial_evidence"] = {}
@@ -338,6 +373,7 @@ def main():
"pipeline",
"cleanup",
"gc-seed",
"pki-research-final",
]:
partial = clone / "evidence" / ("clean-" + name + ".json")
if partial.exists():