feat(scan): add --exclude-paths flag for full Tier 1 exclusion#1298
Draft
Simon (simonhj) wants to merge 7 commits intov1.xfrom
Draft
feat(scan): add --exclude-paths flag for full Tier 1 exclusion#1298Simon (simonhj) wants to merge 7 commits intov1.xfrom
Simon (simonhj) wants to merge 7 commits intov1.xfrom
Conversation
Co-authored-by: Simon <simonhj@users.noreply.github.com>
Lift the --reach gate on --exclude-paths so the flag can filter SCA/SBOM manifest discovery on its own. The Coana --exclude-dirs merge happens unconditionally; consumers (handle-create-new-scan) only run reachability when --reach is set, so the merged options are simply unused otherwise. Move excludePaths out of reachabilityFlags into its own excludePathsFlag export so scan create lists it under the main Options block instead of the reach-only section. scan reach keeps it under Reachability Options since the command is reach-only by definition.
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
--exclude-pathstosocket scan createandsocket scan reachso users can fully exclude directories from a Tier 1 scan — both the SCA/SBOM manifest discovery step and (when reachability runs) Coana's analysis. Patterns supplied to the flag are normalized intosocket.yml-styleprojectIgnorePathsfor SCA and translated into target-relative--exclude-dirspatterns for Coana.The flag works on its own (SCA-only scans) or combined with
--reach. Negation patterns (\!path) are rejected up-front because the flag is a positive exclusion list, not a complete gitignore language.Behavior
tests) are auto-extended to recursive globs (tests/**).socket.ymlprojectIgnorePathscontinue to work unchanged. When the user supplies--exclude-pathsalongside positiveprojectIgnorePaths, both are forwarded to Coana for consistency.scan createwithout--reach: SCA discovery is filtered; reachability is not run.scan create --reachorscan reach: SCA discovery and Coana exclusions both apply.Test plan
pnpm test:unit src/commands/scan/exclude-paths.test.mts src/commands/scan/handle-create-new-scan.test.mts src/commands/scan/handle-scan-reach.test.mts— 17 tests, all passpnpm test:unit src/commands/scan/cmd-scan-create.test.mts src/commands/scan/cmd-scan-reach.test.mts— re-run on a clean install to verify the help-snapshot updatessocket scan create --exclude-paths tests(no--reach)socket scan create --reach --exclude-paths tests,packages/*socket scan reach --exclude-paths build