Interview Prep/DevSecOps/SAST, SCA and secrets scanning in CI

Semgrep job takes 35 minutes and gets killed with `exit code 137`

IntermediateTroubleshootingSAST, SCA and secrets scanning in CI
Answer

Likely causes → OOM on the runner from --config auto across a huge monorepo, very large generated files, or too many jobs in parallel.

Diagnose →

semgrep --config p/default --time --json . > out.json
jq '.time.targets | sort_by(-.run_time) | .[:10] | .[] | {path, run_time}' out.json

Fix → Exclude generated code, cap file size and memory, and scan only changed files on PRs:

semgrep ci --max-target-bytes 1000000 --max-memory 4000 -j 2

semgrep ci is diff-aware on PRs when SEMGREP_BASELINE_REF / PR context is set.

Prevent → Full scans nightly, diff scans on PRs, and a curated ruleset instead of everything.

All DevSecOps questions Roadmap: Security in the pipeline

More on SAST, SCA and secrets scanning in CI