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.
More on SAST, SCA and secrets scanning in CI
gitleaks fails the PR on `tests/fixtures/fake_rsa.pem` and `testdata/aws_creds.json`, which only contain dummy valuesBeginnergitleaks passes locally but the CI job reports 40 old leaks nobody touched in this PRIntermediate`fatal: ambiguous argument 'origin/main..HEAD': unknown revision` in the secrets-scan stepBeginnerSemgrep flags `subprocess.run(cmd, shell=True)` in a script where `cmd` is a hard-coded constantBeginnerSemgrep in CI reports findings in `node_modules/`, `vendor/` and minified `dist/*.js`BeginnerSonarQube Quality Gate fails on "Security Hotspots Reviewed is less than 100%" but there are no vulnerabilitiesBeginner