fix(scanner): honor config matchers.only/exclude#44
Open
yusufnuru wants to merge 3 commits into
Open
Conversation
|
@yusufnuru is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Please re-push with signed commits |
The `matchers.only` and `matchers.exclude` fields in `defineConfig` were
declared in the schema but never read by `scan()` — only the CLI
`--matchers` flag had any effect. Setting `matchers: { exclude: ["xss"] }`
in `deepsec.config.ts` had no effect; xss still ran (vercel-labs#36).
Add a pure `resolveMatchers(registry, cliSlugs, cfg)` helper that wires
the config into matcher selection:
- CLI `--matchers` is treated as exact and overrides config entirely.
- Otherwise, base = `cfg.only ?? all`, then `cfg.exclude` is subtracted.
- Unknown slugs in `only`/`exclude` warn and are ignored.
`scan()` now calls this helper. The CLI also logs the resolved
config-driven filter so the user sees what was applied.
Closes vercel-labs#36
9978c0a to
7a37d8c
Compare
Author
|
Done. |
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.
What changed
scan()now honorsmatchers.onlyandmatchers.excludefromdeepsec.config.tsvia a newresolveMatchers()helper. Closes #36.Why
The
matchers.only/matchers.excludefields were declared in the schema but never read — only the--matchersCLI flag had any effect. Settingmatchers: { exclude: ["xss"] }indeepsec.config.tsdid nothing; xss still ran.Verification
pnpm testpasses (79 unit tests, incl. 8 new inresolve-matchers.test.ts)pnpm lintpassespnpm knippassesNotes for reviewer
Precedence: CLI
--matchersis exact and overrides config entirely. Otherwise base =cfg.only ?? all, thencfg.excludeis subtracted. Unknown slugs inonly/excludewarn (visible) instead of erroring — matches existing silent-drop behavior ofgetBySlugsbut adds visibility. CLI also logs the resolved config-driven filter so it's clear what ran.