Skip to content

Scan the full tree for secrets with exact, reviewed exceptions - #333

Merged
vincent10400094 merged 1 commit into
mainfrom
ci/narrow-secret-exceptions
Sep 29, 2026
Merged

vincent10400094 merged 1 commit into
mainfrom
ci/narrow-secret-exceptions

Conversation

@vincent10400094

Copy link
Copy Markdown
Member

Covers #130 criterion 2: deliberate credential-like test fixtures now pass through explicit, narrow exceptions instead of never being scanned.

  • Exceptions: a root .gitleaksignore lists exact gitleaks fingerprints (path:rule:line), natively supported by the pinned v8.30.1. Only the two current fixtures are listed.
  • tools/scan-secrets.py:
    • requires the exceptions file and passes it explicitly;
    • rejects any entry that is not one exact fingerprint (wildcards, directories, missing rule or line);
    • refuses scans that bring their own .gitleaks.toml, another ignore file, config/baseline flags or GITLEAKS_CONFIG* environment variables;
    • still fails closed.
  • Inline comments: --ignore-gitleaks-allow stays, so inline gitleaks:allow comments cannot bypass review.
  • scripts/ci-secrets.sh:
    • adds a full-tree scan of git archive HEAD alongside the existing base..HEAD and package scans;
    • its control proves that only the one exact finding is exempted, while the same token on another line, in another file or under another rule is still reported.
  • Docs: docs/development/ci.md explains how to add, replace or remove an exception.

Validation: tools/test_ci_security.py passes, including new tests for entry format and refused overrides. A real scan with v8.30.1 finds nothing in the full tree with the exceptions and 2 findings without them. The control reports exactly the three expected findings.

Limitation: exceptions are line-bound, so a moved fixture fails CI until its entry is updated, which fails safe. A stale entry is not detected automatically. Criterion 3 (scanning release artifacts before promotion) depends on the release workflow (#308), so this is related to, not closing, #130.

🤖 Generated with Claude Code

Add a root .gitleaksignore of exact Gitleaks fingerprints for the two
existing credential-negative fixtures, passed explicitly to every scan.
The wrapper rejects non-exact entries and scans that supply their own
config, exception list or overrides. The secret lane now also scans all
tracked files at HEAD, so existing fixtures pass only via the list, and
its control proves an exempted finding is skipped while the same token
elsewhere or under another rule is rejected.

Refs #130

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vincent10400094
vincent10400094 merged commit 5c6287e into main Sep 29, 2026
14 checks passed
@vincent10400094
vincent10400094 deleted the ci/narrow-secret-exceptions branch September 29, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant