Repository navigation
fix: add gitleaks toml filter - #3922
Tiancheng-Xu wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new gitleaks fixtures are internally inconsistent and the on_empty message can misleadingly report a “clean” result when no lines match.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds first-class TOML filtering support for gitleaks output so RTK can compact gitleaks dir / gitleaks git findings into a smaller, consistent set of key fields and summary lines.
Changes:
- Added a new built-in TOML filter
gitleaks.tomlwith inline fixtures fordir,git, and “no secrets” output. - Registered
gitleaksin the built-in TOML filter registry expectations and bumped the built-in filter count to 64.
File summaries
| File | Description |
|---|---|
| src/filters/gitleaks.toml | New TOML filter definition and inline test fixtures for compacting gitleaks output. |
| src/core/toml_filter.rs | Adds gitleaks to the expected built-in filter names list and updates the expected built-in filter count. |
Review details
Suppressed comments (1)
src/filters/gitleaks.toml:79
- The expected output also ends with
0 leaks founddespite two findings in the fixture input; updating it keeps the test coherent.
File: server/.env
Line: 8
Fingerprint: c3b4a8a1d0e7f7c2d5f6d8a9b2f3c4d5e6f70809a:server/.env:stripe-access-token:8
0 leaks found"""
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| max_lines = 120 | ||
| on_empty = "gitleaks: clean" |
There was a problem hiding this comment.
Addressed in e4a487d. Removed the unconditional on_empty clean fallback, and added preservation plus an inline regression fixture for common gitleaks diagnostics such as ERRO[...], so an error cannot be reported as clean.
| File: server/.env | ||
| Line: 8 | ||
| Fingerprint: c3b4a8a1d0e7f7c2d5f6d8a9b2f3c4d5e6f70809a:server/.env:stripe-access-token:8 | ||
| 0 leaks found |
There was a problem hiding this comment.
Addressed in e4a487d. The dir fixture now reports 2 leaks found in both the input and expected output, matching the two findings included in the fixture.
|
Re-checked the requested changes on commit |
Summary
Adds the focused built-in TOML filter for
gitleaksindirandgitmodes.src/filters/gitleaks.toml^gitleaks\s+(dir|git)\bFinding,RuleID,Secret,Entropy,File,Line,Commit,Author,Fingerprint)No secrets found,Found/\d+ leaks|findings)gitleaks dirandgitleaks git+ a no-secrets casesrc/core/toml_filter.rsgitleaksto the expected built-in filter list64Scope / constraints
Validation status
I was not able to run Rust validation in this environment because
cargo/rtktooling is not installed locally.Please run locally before merge:
cargo fmt --all --checkcargo testcargo clippy --all-targetsrtk verify(orcargo run -- verify) and/or PR CIAlso requested, please execute a repo secret/PII scan in your normal environment.
Closes #3921