fix(evidence): run folder-agnostic checks on unmanifested folders (stacked on #115) #116
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/evidence-folder-agnostic-checks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
check-evidence.pyskipped every folder without amanifest.jsonbefore any check, so the folders' JSON files were never secret-scanned. This moves the folder-agnostic checks ahead of the manifest gate so they run on every folder, and adds a placeholder allowlist so benign templates don't fail..json(binary/oversized files are skipped), so aREADME.mdor raw output can no longer hide a credential.<your-key>,${TOKEN},your-token,example,changeme,redacted,dummy,xxx,***. The benignZAI_API_KEY=<your-key>incommand-inventoryis now allowed rather than failing.Verification
Negative test — inject a credential into an unmanifested folder:
ZAI_API_KEY=sk-live-abcdefghijklmnop1234ZAI_API_KEY=<your-key>./scripts/ci-checks.sh— All checks passed../scripts/check-evidence.py— 2 of 6 fully checked, 4 folder-agnostic only, 1 placeholder allowed, 0 errors.Notes / trade-off
command-inventory.--require-manifestsstrict mode, backfilling the two Jev folders, and thekindfield for non-Jev audits.The gate skipped unmanifested folders before any check, so their files were never secret-scanned. Move the folder-agnostic checks (JSON syntax, trailing newline, secret patterns) ahead of the manifest gate so every folder is scanned, and allow documentation placeholders (e.g. <your-key>, ${TOKEN}, changeme) that match the broad credential patterns. Secret scanning now covers all text files in a folder, not only .json, so a README or raw output can no longer hide a credential. Schema, commit, and hash checks stay manifest-gated; the summary now reports both coverage and the number of placeholders allowed. Gates: ci-checks.sh -- All checks passed. Negative test: an injected credential in an unmanifested folder fails the gate as expected.Review — verified in a disposable worktree at
cf96ddd(full stack)The blind spot is closed end-to-end. I injected into an unmanifested, non-JSON file (
phase-0-track-b-valhala/raw-output.txt) and reproduced the claim:ZAI_API_KEY=sk-live-abcdefghijklmnop1234→FAIL ... contains credential-shaped pattern, exit 1 (was silently skipped before).ZAI_API_KEY=<your-key>→ exit 0, counted as a placeholder.Issues / suggestions (non-blocking):
\bsk-[A-Za-z0-9_-]{16,}and\b[A-Z0-9_]*_API_KEY\s*[:=]\s*\S+match. Still fails (fine), but the error count overstates. Considererrors += len(flagged)once per file, or dedupe by line.N file(s) skipped (binary/oversized)to the summary — otherwise a large file is the next uncaught blind spot, exactly the class this PR fixes.sample|fakeis matched inside the secret substring, sosk-live-…-samplewould be allowed. Acceptable trade-off, but please record it as a decision (script docstring or naming-decisions) so it is not re-litigated.scripts/tests/already holdstest_check_okf.py; add a table-driven test forscan_secrets/PLACEHOLDER_RE(placeholder allowed · real secret fails · mixed file increments both · omitted newline). This is precisely the logic that regresses silently.mainafter #115 merges.cf96ddd120fc537bba65