Full SAST on a large monorepo takes 40 minutes. How do you cut it?
AdvancedScenarioPipeline Security Scanning
Answer
Situation read → Full scans on every PR are wasteful. Most changes touch a small part of the tree.
What I'd do →
- Diff-aware scans on PRs (
semgrep ciwith--baseline-commit). - Path filters in the pipeline so only affected services are scanned.
- Shard by directory in parallel jobs.
- Run a full scan nightly on the default branch and track new findings there.
- For CodeQL, use incremental analysis and cache the database where supported.
Why → PR scans need speed, nightly scans need completeness. Splitting them keeps both.
Interview tip → Tie the answer to developer wait time as a measurable metric.
More on Pipeline Security Scanning
You are asked to add security to an existing CI pipeline. Where do SAST, SCA, secrets scanning and DAST each go?BeginnerGitleaks flags an AWS access key in a pull request. The developer says it is a test key. What do you do?BeginnerDevelopers fear security scans will slow the pipeline from 6 to 20 minutes. How do you roll them out?BeginnerA SAST tool reports 2,000 findings on a legacy repo the first time you run it. How do you introduce it without freezing delivery?IntermediateA developer insists a scanner finding is a false positive. What is your process?BeginnerSCA flags a critical CVE in a transitive dependency and no patched version exists. What are your options?Intermediate