feat(cli): add --scan-timeout guard for large projects - #1100
Open
Ayush7614 wants to merge 1 commit into
Open
Conversation
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.
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.
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
--scan-timeout <duration>flag (90,90s,5m,1500ms; 1s min, 60m max) plusCVE_LITE_SCAN_TIMEOUTenv fallback.src/utils/scan-timeout.ts: parser, resolver,withScanTimeout()race,ScanTimeoutErrorwith actionable guidance.scanProject) and multi-folder (handleMultiFolderScan) paths; expiry exits3with guidance instead of hanging.src/cli/validate.ts, help text, andwebsite/docs/cli-reference.md.Verification
tests/scan-timeout.test.ts: 13 tests pass (unit parsing, env resolution, timeout race, CLI wiring, validation).npm run buildpasses.