Skip to content

feat(scan): add --exclude-paths flag for full Tier 1 exclusion#1298

Draft
Simon (simonhj) wants to merge 7 commits intov1.xfrom
simon/reach-ignore-flag
Draft

feat(scan): add --exclude-paths flag for full Tier 1 exclusion#1298
Simon (simonhj) wants to merge 7 commits intov1.xfrom
simon/reach-ignore-flag

Conversation

@simonhj
Copy link
Copy Markdown

@simonhj Simon (simonhj) commented May 4, 2026

Summary

Adds --exclude-paths to socket scan create and socket scan reach so 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 into socket.yml-style projectIgnorePaths for SCA and translated into target-relative --exclude-dirs patterns 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

  • Bare names (tests) are auto-extended to recursive globs (tests/**).
  • Trailing slashes are stripped.
  • Existing socket.yml projectIgnorePaths continue to work unchanged. When the user supplies --exclude-paths alongside positive projectIgnorePaths, both are forwarded to Coana for consistency.
  • scan create without --reach: SCA discovery is filtered; reachability is not run.
  • scan create --reach or scan 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 pass
  • pnpm 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 updates
  • Manual smoke: socket scan create --exclude-paths tests (no --reach)
  • Manual smoke: socket scan create --reach --exclude-paths tests,packages/*
  • Manual smoke: socket scan reach --exclude-paths build

Cursor Agent (cursoragent) and others added 7 commits May 4, 2026 17:49
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.
@simonhj Simon (simonhj) changed the base branch from main to v1.x May 4, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants