test(v2): define secure control-plane contracts

This commit is contained in:
2026-07-27 19:56:01 +02:00
parent 8b831fc985
commit cb864bcac5
12 changed files with 499 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
from __future__ import annotations
import subprocess
import sys
def test_leakage_scan_rejects_canary_and_accepts_clean_file(tmp_path) -> None:
path = tmp_path / "output.txt"
path.write_text("safe output", encoding="utf-8")
clean = subprocess.run(
[sys.executable, "tools/leakage_scan.py", "--canary", "secret-canary", str(path)],
capture_output=True,
text=True,
check=False,
)
assert clean.returncode == 0
path.write_text("oops secret-canary escaped", encoding="utf-8")
leaked = subprocess.run(
[sys.executable, "tools/leakage_scan.py", "--canary", "secret-canary", str(path)],
capture_output=True,
text=True,
check=False,
)
assert leaked.returncode == 1
assert "output.txt" in leaked.stdout