Repository navigation
fix(security): enable gitleaks default rules in .gitleaks.toml template (#1395) - #1412
Conversation
…te (#1395) A config passed via `--config` replaces gitleaks' built-in ruleset. The allowlist-only .gitleaks.toml and standards/gitleaks.toml had no `[extend] useDefault = true`, so the secret-scan job ran with zero rules and reported "no leaks found" on any history. Add the extend block to both files (the _bmad/ allowlist from #996 is kept). Add detection regression tests to test/workflows/ci/secret-scan-config.bats that run the pinned gitleaks against a throwaway repo with synthetic credentials generated at test time, and install the same pinned, checksum-verified gitleaks release in ci-tests.yml (asserted to stay in lockstep with ci.yml). Document the mandatory extend block in standards/push-protection.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This comment has been minimized.
This comment has been minimized.
Dev-Lead — waiting on PR blockers (intent: review-changes)PR: #1412 |
|
Note @don-petry I reviewed this PR and no code changes were needed, but I can't mark it done yet: required check |
|
Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-10-28T04:08:37Z. |
|
No description provided. |
|
Codex review failed to complete — this is a transient tooling issue, not a code defect. All CI checks pass. No code changes are needed. |
Dev-Lead — fix-bot-comment (no-changes)Agent reasoning |
|
No description provided. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
|
No description provided. |
This comment has been minimized.
This comment has been minimized.
Dev-Lead — fix-bot-comment (no-changes)Agent reasoning |
|
No description provided. |
|
Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-10-28T12:48:13Z. |
|
|
No description provided. |
|
Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-10-28T16:41:43Z. |
|
Re-read the current body of this CodeRabbit summary. It contains only the review-limit notice (free OSS reviews used, next review in ~59 minutes), run configuration, the list of 6 files selected, and the Autofix opt-in checkbox. There is no Security Architecture section, no actionable, outside-diff or nitpick findings. No action needed; no code change. |
Dev-Lead — fix-reviews (no-changes)Agent reasoning |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: 095ef5c190b484e90dbfdf754805659b1c46a653
Review mode: triage-approved (single reviewer)
Summary
Fixes a real security misconfiguration: .gitleaks.toml and the standards/gitleaks.toml template were allowlist-only. Because a --config file replaces gitleaks' built-in ruleset, the Secret scan (gitleaks) job ran with zero rules. The PR adds [extend] useDefault = true to both files, corrects the misleading comment in ci.yml (comment only, the command is unchanged), documents the requirement in standards/push-protection.md, and adds bats tests that run the pinned gitleaks binary against a throwaway repo holding synthetic credentials, plus a zero-rule control. ci-tests.yml installs gitleaks v8.30.1 with the same retry loop and SHA-256 checksum as ci.yml (job permissions contents: read). A test checks that the two workflows stay pinned to the same version. The change only tightens the security control, and this PR's own Secret scan (gitleaks) check passed with the default rules turned on, so enabling them does not red main. Triage's low-risk assessment holds. I rate it MEDIUM rather than LOW because it changes CI workflow behaviour and an org standards template.
Linked issue analysis
Closes #1395 (gitleaks secret scan runs with zero rules). The issue asks for default-rule inheritance and notes that the existing tests only checked that the file exists and that the command passes --config, not that a synthetic secret is detected. The PR does both: it enables useDefault in both configs and adds detection tests that assert the aws-access-token and github-pat RuleIDs, plus a control test. The issue is fully addressed, so Fixes #1395 is appropriate.
Findings
No blocking findings.
Non-blocking notes:
- Downstream rollout (author-flagged). Repos that already copied the old template still scan with zero rules, and syncing the fix may red their required
Secret scan (gitleaks)check until historical findings are triaged. That rollout is correctly left out of this PR. Consider opening a tracking issue for the standards-sync and the proposedgitleaks_config_extends_defaultscompliance check so they are not lost when #1395 auto-closes. - Test brittleness (minor). The detection assertions grep for
"RuleID": "..."in the JSON report, which depends on gitleaks' output formatting. That is acceptable while the version is pinned and the lockstep test exists, but expect to revisit it on a gitleaks upgrade. - Fixture hygiene. Synthetic credentials are assembled at runtime from split literals, so nothing secret-shaped is committed. The repo's own gitleaks scan passed on this head.
- Secret scan (MCP).
run_secret_scanningwas not available in this environment, so it was skipped. The gitleaks CI check passed.
CI status
All checks completed without failures. Secret scan (gitleaks), bats (x2), Lint, ShellCheck, CodeQL / Analyze (actions, python), SonarCloud (Quality Gate passed), AgentShield, Agent Security Scan, duplicate-decl-gate and dependency-audit all succeeded. Skipped and neutral checks (dependabot, dev-lead relay jobs, the inapplicable audit ecosystems, and CodeRabbit, which was rate-limited) are not applicable. There are no unresolved review threads and no outstanding human questions.
Reviewed automatically by the PR-review agent (single-reviewer mode: opus 5.5 [opus 4.8, opus 4.7]). Reply if you need a human review.
|
pr-review approved on PARTIAL advisory evidence: 1/5 required advisory bots reported before the gate's head-age-timeout fallback proceeded. Recorded for the miss-rate metric (#1596). |



Summary
.gitleaks.tomland thestandards/gitleaks.tomltemplate held only an[allowlist]. A file passed via--configreplaces gitleaks' built-in ruleset, so theSecret scan (gitleaks)job loaded zero detection rules and passed on any history. This PR adds[extend] useDefault = trueto both files, adds detection regression tests that run the real scanner, and documents the requirement.Fixes #1395
How it was confirmed. Local gitleaks is v8.30.1, the same version
ci.ymlpins (.github/workflows/ci.ymlsecret-scan job;standards/workflows/ci.ymlpins 8.30.1 too). I generated synthetic, obviously fake credentials at runtime (an AWS-access-key-shaped string and aghp_-shaped string) and scanned them:.gitleaks.toml(origin/main)no leaks found, exit 0standards/gitleaks.toml(origin/main)no leaks found, exit 0[extend] useDefault = trueaws-access-token,github-pat,generic-api-key), exit 1I got the same results with
gitleaks dir,gitleaks detect --no-git, and git-history mode (gitleaks detect --source <repo>, the invocation CI uses).Fix
.gitleaks.tomlandstandards/gitleaks.toml: add[extend] useDefault = true, with a comment saying it must not be removed. The_bmad/path allowlist from [Fleet Monitor] petry-projects/.github — .github/workflows/ci.yml #996 is unchanged, so default rules plus that allowlist is the behavior [Fleet Monitor] petry-projects/.github — .github/workflows/ci.yml #996 originally intended..github/workflows/ci.yml: comment only. TheRun gitleakscomment wrongly said--configexists to avoid the default ruleset. It now explains the allowlist and the mandatory extend block. The command is unchanged.standards/push-protection.md: the template block now includes the extend block, plus a paragraph explaining why it is mandatory.standards/workflows/ci.ymlis unchanged, because the root cause is the config file and not the job.History check with default rules enabled. I ran
gitleaks detect --source . --config .gitleaks.toml --redact --exit-code 1over this repo's full history (all refs, 1,401 commits, including this branch) with the new config: no leaks found. Turning the rules on does not redmain.Regression tests (
test/workflows/ci/secret-scan-config.bats, TDD: written first; on origin/main tests 4–7 and 9 fail, and all pass with the fix)useDefault = trueinside[extend](static parse).gitleaks detectruns in git-history mode against a throwaway repo. Assertions are on exit 1 plus theaws-access-tokenandgithub-patRuleIDs in the JSON report.ci-tests.ymlinstalls the same gitleaks version and checksum asci.yml, so the tests can't silently drift from the binary CI scans with.CI wiring:
.github/workflows/ci-tests.ymlnow installs gitleaks v8.30.1 exactly the wayci.ymldoes:gh release downloadwith a bounded retry loop andsha256sum -cagainst the same pinned checksum. Itspaths:filters now include.gitleaks.tomlandstandards/gitleaks.toml.Test commands
bats test/workflows/ci/: 21/21 okactionlint .github/workflows/ci.yml .github/workflows/ci-tests.yml: cleanshellcheck -s bash test/workflows/ci/secret-scan-config.bats: cleanmarkdownlint-cli2 standards/push-protection.md: 0 errorsgitleaks detectwith the new config: no leaks foundFollow-ups / rollout (needs a human decision)
standards/gitleaks.toml(seeded byseed-repo-template.sh, which lives outside this repo) is also scanning with zero rules. This PR fixes the template only. Existing copies need a standards-sync pass, and those repos' histories have never been scanned with real rules. Turning the rules on may red theirSecret scan (gitleaks)required check until findings are triaged or rotated. I'd suggest runninggitleaks git --redactper repo before or alongside the sync..gitleaks.tomlcontents (scripts/lib/push-protection.shonly checks thatci.ymlinvokes gitleaks). A content check such asgitleaks_config_extends_defaultscould catch regressions fleet-wide. It is left out here because it would flag every existing repo at once, so it should be planned together with the sync above.🤖 Generated with Claude Code
Problem
See the linked issue.
Risk
Medium — changes GitHub Actions workflow behavior, which is exercised only post-merge; verify via the affected workflow runs.
Test plan
Tests added/updated:
test/workflows/ci/secret-scan-config.bats. Verification:bash scripts/dev-lead-lint.sh(shellcheck --severity=warning) ran pre-commit; the bats suite runs in CI.Rollback
Revert this PR. No non-revertible side effects (no tags, migrations, or external state).
Monitoring
Watch the affected workflow run(s) in the Actions tab and this PR's Lint check for regressions.