feat(cli): --disable-rule flag in scan and ci commands#716
Merged
Conversation
Pure validator for the upcoming --disable-rule flag. Mirrors the
validateExcludePatterns pattern: trims whitespace, drops empties, dedups,
rejects anything outside [A-Za-z0-9_-]{1,64}. The strict charset stops
downstream callers (cpf-executor populating argv from a D1 lookup) from
smuggling shell metacharacters or path-traversal patterns.
Repeatable CLI flag that drops matching rule IDs from the rule loader before execution. Validated via validateDisableRules (strict charset, dedup, length cap). Mirrors --exclude in shape, validation, and wiring. Smoke: scan + --disable-rule SAST-CMD-001 against a positive fixture returns no findings for that rule, others still fire.
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
Pathfinder Report✅ No security findings on the changed files. This pull request is clean. Powered by Code Pathfinder. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #716 +/- ##
==========================================
- Coverage 85.56% 85.48% -0.09%
==========================================
Files 191 192 +1
Lines 27467 27523 +56
==========================================
+ Hits 23503 23527 +24
- Misses 3075 3104 +29
- Partials 889 892 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds a repeatable
--disable-rule <id>flag to bothpathfinder scanandpathfinder cithat drops the named rules from the loader before execution. Mirrors the--excludeflag added in PR #690 in shape, validation, and wiring.Unblocks the rule-registry feature (spec: cpf-dashboard@b748501). cpf-executor will populate the flag from per-org / per-repo overrides resolved server-side.
Validation
validateDisableRulesrejects rule IDs outside[A-Za-z0-9_-]{1,64}. Strict on purpose: cpf-executor will pass these as argv elements built from a D1 lookup, and the charset stops shell metacharacters or path-traversal patterns from sneaking through even if the API layer regresses.Empty and duplicate entries are silently dropped (matches the
--excludeconvention).Test plan
go build ./...,go test ./...(31 packages): clean.pathfinder scan -p sast-engine/test/fixtures/vulnerable_project --rules sast-engine/test/fixtures/rules/simple.pyproduces a TEST-001 finding. Adding--disable-rule TEST-001reduces the rule set to zero and pathfinder correctly emitsno rules loaded(proves the filter actually ran before the rule-count gate).