forked from mtusi2026/mtusi2026lab7
test(security): verify full lifecycle and audit clean-clone private material
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user