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

Security scans pass on PRs from forks without reporting anything, but fail on main

AdvancedTroubleshootingSAST, SCA and secrets scanning in CI
Answer

Likely causes → Fork PRs get no secrets, so SonarQube/Snyk tokens are empty and the step is skipped or continue-on-error swallows the auth failure.

Diagnose → Look for empty tokens or 401 in fork run logs; check if: conditions and continue-on-error: true.

Fix → Run token-free scanners (Semgrep OSS, gitleaks, Trivy fs) on pull_request, and token-based ones in a workflow_run job that checks out the PR code read-only. Never use pull_request_target with a checkout of PR code and secrets.

Prevent → Make a missing token a hard failure on trusted branches, and audit for silent continue-on-error.

All DevSecOps questions Roadmap: Security in the pipeline

More on SAST, SCA and secrets scanning in CI