CI/CD & Deployment interview question · Most asked

What is shift-left testing, and what security scanning belongs in a CI pipeline?

Definition Asked in DevOps Engineer · Site Reliability Engineer (SRE) · QA Engineer / SDET interviews

Members can save this page, take notes and track progress. See membership · Sign in

Summary

Shift-left means moving testing and security checks earlier in the development lifecycle — into the IDE, pre-commit hooks and CI pipeline rather than waiting for a manual review or a production incident. SAST, SCA and secret scanning belong in every CI pipeline; DAST and container scanning belong in staging.

Longer Answer

The idea is simple: the earlier you find a bug or vulnerability, the cheaper it is to fix. A security issue caught in a pull request takes minutes to fix; the same issue found in production takes days and may cause a breach.

Security scanning types:

Type What it checks When to run Tools
SAST (Static Application Security Testing) Source code for vulnerabilities (SQL injection, XSS, hardcoded secrets) On every PR, as a CI step Semgrep, CodeQL, SonarQube
SCA (Software Composition Analysis) Dependencies for known CVEs On every PR and on a schedule (new CVEs appear daily) Dependabot, Snyk, Trivy, Grype
Secret scanning Committed secrets (API keys, passwords, tokens) Pre-commit hook + CI step Gitleaks, TruffleHog, GitHub secret scanning
Container scanning Container images for OS-level CVEs After image build, before push Trivy, Grype, Snyk Container
DAST (Dynamic Application Security Testing) Running application for runtime vulnerabilities Against staging, after deploy OWASP ZAP, Nuclei
IaC scanning Terraform/CloudFormation for misconfigurations On every PR Checkov, tfsec, KICS

Pipeline placement:

  • Pre-commit: secret scanning, linting (fast, local).
  • CI on PR: SAST, SCA, IaC scanning, container scanning (automated, blocking).
  • Post-deploy to staging: DAST (needs a running app).
  • Scheduled: SCA re-scan (new CVEs against existing dependencies).

Key principle: make security checks fast and non-disruptive. If SAST takes 20 minutes, developers will work around it. Incremental scanning (only changed files) and caching keep the feedback loop tight.

Key Points

  • Shift-left means catching issues earlier — in PRs and CI, not in production
  • SAST and SCA run on every PR; DAST runs against staging after deploy
  • Secret scanning belongs in pre-commit hooks AND CI (defense in depth)
  • Speed matters: slow security scans get bypassed — use incremental scanning

Explanation

What interviewers look for

Look for a practical understanding of which scans go where and why. Weak answers list all tools without explaining when each runs. Strong answers balance thoroughness with developer experience and mention scheduled SCA re-scans for new CVEs.

More CI/CD & Deployment questions

← All CI/CD & Deployment questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake