review: Astra round 4 brief for gitleaks-1251
The last round: both R3 P1s, the exact-path exclusion, the sentinel and the docs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+94
−0
docs/superpowers/reviews/REVIEW-BRIEF-gitleaks-1251-R4.md+94 −0
CI cancelled — superseded by a newer push — run details
diff --git a/docs/superpowers/reviews/REVIEW-BRIEF-gitleaks-1251-R4.md b/docs/superpowers/reviews/REVIEW-BRIEF-gitleaks-1251-R4.md| new file mode 100644 |
| index 000000000..55bdbe380 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/REVIEW-BRIEF-gitleaks-1251-R4.md |
| @@ -0,0 +1,94 @@ |
| +# Review brief: branch gitleaks-1251, round 4 of 4 |
| + |
| +Repo carlos/platform, branch `gitleaks-1251`, commit 99612d24. |
| +Under review: the diff `origin/main...99612d24`. The R3 diff was |
| +`origin/main...7aac4320`; `git diff 7aac4320 99612d24` minus the merge |
| +of origin/main (2b8fd0e7, no conflicts, nothing in the gate) is what changed. |
| +Authorities: amadan #1251 (the design and Paul's 2026-11-19 ruling), |
| +AGENTS.md ("Stopping rules"), `docs/superpowers/reviews/FINDINGS-gitleaks-1251-R3.md`. |
| + |
| +**This is the last round.** Paul allowed a fourth round with a fixed scope |
| +and there is no fifth. Review that scope. Do not ask for a different design. |
| + |
| +## What changed since R3 |
| + |
| +Paul chose the first option on #1251: stop judging digests by shape, leave |
| +the digest files out by exact path, and say so plainly. |
| + |
| +1. **R3 P1 1 (digest-shaped approvals).** `scripts/gitleaks-gate/judge.go` |
| + is deleted. The new `scripts/gitleaks-gate/notscanned.go` lists 26 |
| + whole repository paths: the 25 census test files gitleaks flags for their |
| + sha256 digests, and `implementation/always-awake-consumers.json`. |
| + `copyTracked` (`main.go:246`) compares each git path to the list for |
| + equality and does not copy a listed file, so gitleaks never reads it. |
| + An entry naming a path git does not track fails the step (`main.go:302`). |
| + Every other finding fails the step. The 9B8 chunk-boundary fragment |
| + allowance in `.gitleaks.toml` applied only to a file that is now not |
| + scanned, so it was removed. The other allowances are unchanged. |
| + **Accepted limit, stated in the docs:** a credential committed in one of |
| + the 26 listed files is not found. |
| +2. **R3 P1 2 (sentinel overwrote a tracked file).** The sentinel goes in |
| + `gitleaks-gate-sentinel-<random>.env`, a new name on each run, opened |
| + with `O_CREATE|O_EXCL` (`main.go:200`). Only a finding with the |
| + sentinel's exact value in that file is set aside (`main.go:219`). |
| +3. **Self-test.** The census, checklist and chunk-boundary cases went with |
| + the judge. The new `trackedTest` (`selftest.go:146`) builds a git |
| + repository and runs `scanTree`, the path the real scan takes. It plants |
| + a key in a tracked `gitleaks-gate-sentinel.env` and in a census file the |
| + list does not name, and requires both to be reported. It plants a key in |
| + every listed file and requires none of those to be reported. For each |
| + listed name it plants three near misses (`x/` + path, path + `.orig`, |
| + `zz_` + file name) and requires each to be reported. It also untracks one |
| + listed file and requires `copyTracked` to refuse. With the old sentinel |
| + code restored (fixed name, `O_TRUNC`), the self-test fails with |
| + "THE PLANTED KEY WAS HIDDEN in gitleaks-gate-sentinel.env". |
| +4. **Docs.** `.gitleaks.toml` header, `.amadan/ci.d/80-gitleaks` header, |
| + the Makefile comment, `.amadan/README.md` ("`gitleaks`: what turns it |
| + red") and the AGENTS.md bullet now say which files are not scanned and |
| + why: they hold content digests, not secrets. |
| + |
| +Local results at 99612d24: `sh .amadan/ci.d/80-gitleaks` passes (10,581 |
| +files scanned, 26 not scanned, clean). In a scratch clone with planted keys |
| +in a new source file, a tracked `gitleaks-gate-sentinel.env` and a census |
| +file not on the list, it fails with all three reported. |
| + |
| +## What to check |
| + |
| +1. **Both R3 P1s are closed.** No finding is accepted because of its shape |
| + or its line. Nothing except the sentinel's exact value in its own random |
| + file is set aside. |
| +2. **The exclusion is exact and cannot be widened by a rename.** Check that |
| + it uses string equality on the full git path, with no glob, prefix, |
| + suffix, case folding or path cleaning that a crafted tracked path |
| + (`./`, `..`, a trailing slash, a different case, a symlink, a |
| + submodule, a path git quotes) could exploit. Check that a listed file |
| + renamed elsewhere is scanned under its new name, and that a stale entry |
| + fails. Known edge: one commit that renames listed file A and adds a new |
| + file at A keeps A excluded. The commit's diff shows the rename, but |
| + `notscanned.go` does not change. Judge whether that is acceptable |
| + under "named files are not scanned" or is a P1. |
| +3. **The sentinel cannot shadow a tracked file.** Look for any ordering, |
| + name collision or error path where a tracked file's bytes are replaced, |
| + dropped or set aside. Check that `trackedTest` really exercises the |
| + production `scanTree`/`copyTracked`, and would fail if either regressed. |
| +4. **Fails closed.** Missing or wrong-version binary, a config that does |
| + not load, a truncated report, zero files copied, a missing sentinel |
| + finding, a stale list entry, a tracked `.gitleaksignore`. |
| +5. **The docs are true.** Every text that describes the gate (config |
| + header, step header, Makefile, README, AGENTS.md) says plainly that the |
| + listed files are not scanned and why, and matches the code. Nothing |
| + still describes the judge. |
| +6. The remaining `.gitleaks.toml` allowances are byte-for-byte the R3 ones, |
| + minus the 9B8 fragment. |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. |
| +- **P2**: wrong or missing. Fixed without reopening this review. |
| +- **P3**: clarity or polish. Follow-up list only. |
| + |
| +## Output |
| + |
| +Findings ranked P1, then P2, then P3, each with file:line, failure scenario |
| +and fix. End with exactly one verdict: READY, READY AFTER FIXES, or NOT |
| +READY. Do not edit files, spawn reviewers or run full suites. |