chore(ci): gitleaks allowlist for spec/docs markdown false positives - #89
Conversation
📝 WalkthroughWalkthroughThe Gitleaks configuration adds allowlist patterns for Markdown files under ChangesSecret scan allowlist
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
EXTENDS the existing HT-12 test-fixture allowlist (first push of this branch wrongly replaced the file — check-before-overwrite lesson re-learned). The generic-api-key rule fired on quoted prose in specs/modules/marketplace-v1.md; since CI's checkout fetches all branches, one flagged commit on any pushed branch fails every PR's scan. Spec/docs markdown carries worked token-format examples by design; scanning stays fully active for code, config, workflows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
47b139a to
823664d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.gitleaks.toml:
- Around line 17-18: Narrow the global path entries in the .gitleaks.toml
allowlist so they do not suppress all findings under specs/**/*.md and
docs/**/*.md. Replace them with specific false-positive files or patterns,
preferably rule-specific entries that match both the affected path and content
while preserving detection elsewhere.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| '''^specs/.*\.md$''', | ||
| '''^docs/.*\.md$''', |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== .gitleaks.toml ==\n'
cat -n .gitleaks.toml
printf '\n== gitleaks references ==\n'
rg -n "gitleaks|allowlist|path" -S .github . 2>/dev/null | sed -n '1,200p'Repository: Helpthread/helpthread
Length of output: 23169
🌐 Web query:
gitleaks allowlist path suppress findings matching paths documentation
💡 Result:
To suppress findings by file path in Gitleaks, you can define allowlists in your gitleaks.toml configuration file [1][2]. There are two primary ways to do this depending on whether you want the exclusion to be global or rule-specific [1][3]. Global Allowlists Global allowlists apply to all rules and take precedence over rule-specific allowlists [1]. Use the [allowlist] section to define these [1][3]. [allowlist] description = "global allow list" paths = [ '''path/to/exclude/.*''', '''another/file.json''' ] Rule-Specific Allowlists If you want to exclude a path only for a particular rule, use the [[rules.allowlists]] section nested under the corresponding rule [1][3]. Note that in newer versions (v8.21.0 and later), [rules.allowlist] was replaced by [[rules.allowlists]] to support multiple allowlist entries per rule [1]. [[rules]] id = "my-specific-rule" #... other rule configuration... [[rules.allowlists]] description = "ignore this file for this rule" paths = [ '''path/to/specific/file.js''' ] Important Implementation Details 1. Regular Expressions: The paths field accepts a list of regular expressions [4][5]. Ensure you use triple quotes (''') in your TOML for raw strings to avoid escaping issues with backslashes [1][6]. 2. Conditions: You can combine multiple criteria (like paths, regexes, or commits) within an allowlist using a condition field, which defaults to "OR" [1][5]. Setting condition = "AND" ensures that a finding is only ignored if all defined criteria match [1]. 3. Precedence: Gitleaks applies global allowlists first, followed by rule-specific allowlists [4]. 4. Validation: Always ensure your gitleaks.toml syntax is correct. Using [[rules.allowlists]] without a valid rule id or using unsupported sections can lead to configuration errors [3]. 5. Extending Default Config: When using [extend] useDefault = true, verify that your rule-specific allowlists are correctly targeting the id of the rule you intend to modify [7][3]. For detailed debugging, Gitleaks logs usually indicate whether allowlists were evaluated and applied during a scan [7]. If a path is not being excluded, double-check that the regex pattern matches the file path correctly [8].
Citations:
- 1: https://github.com/gitleaks/gitleaks/blob/83a57244cdd0bfe1634326ab04a29b9b139bf158/README.md
- 2: https://community.atlassian.com/forums/Bitbucket-questions/Can-i-choose-which-files-to-exclude-from-scanning-in-the-git/qaq-p/2913971
- 3: Allowlists not working gitleaks/gitleaks#1590
- 4: https://deepwiki.com/gitleaks/gitleaks/4.4-allowlists-and-baselines
- 5: https://github.com/gitleaks/gitleaks/blob/4fb43823/config/allowlist.go
- 6: https://github.com/gitleaks/gitleaks/blob/4fb43823/cmd/generate/config/rules/config.tmpl
- 7: Rule-specific allowlist paths not working with extend useDefault = true gitleaks/gitleaks#1844
- 8: Allowlist entry in gitleaks.toml does not skip detection of pattern gitleaks/gitleaks#1878
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Show the exact lines around the allowlist entries
sed -n '1,120p' .gitleaks.toml
# Locate any CI invocation that scans history or uses config flags
rg -n "gitleaks.*detect|gitleaks.*protect|git log|full history|history" -S .github . 2>/dev/null | sed -n '1,200p'Repository: Helpthread/helpthread
Length of output: 23188
Scope the .gitleaks.toml allowlist more narrowly
.gitleaks.toml:17-18 is a global path allowlist, so it suppresses every Gitleaks finding in specs/**/*.md and docs/**/*.md. Narrow this to the specific false-positive files or patterns, ideally with a rule-specific allowlist that matches both path and content.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.gitleaks.toml around lines 17 - 18, Narrow the global path entries in the
.gitleaks.toml allowlist so they do not suppress all findings under
specs/**/*.md and docs/**/*.md. Replace them with specific false-positive files
or patterns, preferably rule-specific entries that match both the affected path
and content while preserving detection elsewhere.
…(HT-79) (#86) * docs(charter): marketplace becomes a launch-day component of Phase 3 (HT-79) TJ's call (2026-07-19): 'later' is now. §3/§4/§5 amended with a dated, reasoned note in the established tradition — deferral rationale obsolete (substrate + first modules shipped during dogfood), license stays a distribution credential (no runtime checks, catalog §5), §7-exception deadline unchanged (v1 modules are all out-of-process), counsel gains commercial-license + terms-of-sale items before real money. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(charter): Modules vocabulary in §4's build-time track (HT-79) CodeRabbit caught the pre-existing 'build-time npm plugins' phrase in the paragraph this amendment touches — the vocabulary rule reserves 'plugin' for the legal phrase; swept while amending. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore: recompute CI merge ref against main's gitleaks allowlist (#89) --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The Secret scan on #87/#88 fails on a single generic-api-key hit that is quoted prose in a spec (admin-ia.md's own 'license key, in-place update…' sentence quoted in marketplace-v1.md). Specs/docs markdown carries worked token-format examples by design — this scopes an allowlist to
specs/**/*.md+docs/**/*.mdonly; scanning stays fully active for all code, config, and workflows. Local full-history scan with this config: clean.🤖 Generated with Claude Code
Summary by CodeRabbit