Skip to content

feat(cli): add --scan-timeout guard for large projects - #1100

Open
Ayush7614 wants to merge 1 commit into
OWASP:mainfrom
Ayush7614:feature/scan-timeout-983
Open

feat(cli): add --scan-timeout guard for large projects#1100
Ayush7614 wants to merge 1 commit into
OWASP:mainfrom
Ayush7614:feature/scan-timeout-983

Conversation

@Ayush7614

Copy link
Copy Markdown
Collaborator

Closes #983.

Summary

Large monorepos can stall a scan for minutes (lockfile parsing, OSV batch fan-out, usage scanning) with no deterministic guard, forcing CI to rely on the job-level timeout.

Changes

  • New --scan-timeout <duration> flag (90, 90s, 5m, 1500ms; 1s min, 60m max) plus CVE_LITE_SCAN_TIMEOUT env fallback.
  • New src/utils/scan-timeout.ts: parser, resolver, withScanTimeout() race, ScanTimeoutError with actionable guidance.
  • Wired into both single-folder (scanProject) and multi-folder (handleMultiFolderScan) paths; expiry exits 3 with guidance instead of hanging.
  • Validation in src/cli/validate.ts, help text, and website/docs/cli-reference.md.

Verification

  • New tests/scan-timeout.test.ts: 13 tests pass (unit parsing, env resolution, timeout race, CLI wiring, validation).
  • npm run build passes.

Closes OWASP#983.

Large monorepos can stall a scan for minutes with no deterministic guard,
forcing CI to rely on the job-level timeout. This adds --scan-timeout
(90, 90s, 5m, 1500ms; 1s min, 60m max) plus CVE_LITE_SCAN_TIMEOUT env
fallback, raced against both single-folder and multi-folder scans. On
expiry the CLI exits 3 with an actionable message instead of hanging.
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.

Performance: Add scan timeout option for large projects

1 participant