Q: Explain your end-to-end CI/CD pipeline. Where would you integrate security scanning into the CI/CD pipeline?
Complete architectural blueprint of an enterprise DevSecOps pipeline: shifting security left across commit, pull request, build, packaging, deployment, and runtime admission verification.
Master cloud-native security and container runtime defense: Prepare with KodeKloud's CKS course with live browser-based terminal sandboxes.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: A mature DevSecOps pipeline does not treat security as a final checkpoint. Security scanning is embedded as automated 'quality gates' at every single stage of the software development lifecycle (SDLC).
Stage 1: Pre-Commit & Pull Request (Shift-Left)
Catch bugs and vulnerabilities before code is merged to main:
- Pre-Commit Hooks:
pre-commitrunning TruffleHog / GitGuardian to prevent developers from accidentally committing hardcoded AWS keys or passwords. - Static Application Security Testing (SAST): SonarQube or Semgrep scans source code on PR for OWASP Top 10 vulnerabilities (SQLi, XSS, insecure deserialization).
- Software Composition Analysis (SCA): Snyk or OWASP Dependency-Check scans third-party libraries (npm, pip, maven) against national vulnerability databases (CVEs).
Stage 2: Build, Container Scan & Cryptographic Signing
Securing artifacts in the pipeline:
- Multi-Stage Minimal Build: Docker builds using minimal distroless or Alpine base images running as non-root (UID 10001).
- Container Vulnerability Scanning: Trivy or Grype scans the built image for OS-level and library vulnerabilities (breaks build if unpatched Critical CVE exists).
- SBOM Generation: Generate Software Bill of Materials using Syft in SPDX/CycloneDX format.
- Cryptographic Image Signing: Cosign (Sigstore) signs the image digest using Keyless OIDC signatures before pushing to ECR/ACR.
Stage 3: GitOps Delivery & Cluster Admission Enforcement
Zero-trust deployment and runtime guardrails:
- GitOps Sync (ArgoCD): Updates image tag in the Git manifest repository; ArgoCD reconciles with Kubernetes cluster.
- Kubernetes Admission Controller: Kyverno or OPA Gatekeeper inspects every pod creation: verifies Cosign signature, blocks images without approval, enforces non-root execution, and rejects privileged containers.
- Runtime Threat Detection: Falco monitors kernel system calls in production for abnormal execution (e.g. bash spawned inside container).
- Phase 1 (Code/PR): Secret scan (TruffleHog), SAST (SonarQube/Semgrep), and SCA dependency scan (Snyk). Block merge on Critical CVEs.
- Phase 2 (Build): Build distroless container, scan image with Trivy, generate SBOM with Syft, and cryptographically sign image with Cosign.
- Phase 3 (Deploy): GitOps with ArgoCD deploying signed image manifests.
- Phase 4 (Admission): Kyverno admission controller blocks unsigned images or root containers at the cluster gate.
- Phase 5 (Runtime): Falco kernel monitoring for runtime intrusion detection.
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Revoking compromised credentials immediately without analyzing forensic audit trails for active exploitation when addressing end-to-end Deactivating a compromised access key prevents abuse while preserving forensic identity for CloudTrail investigations to assess blast radius.
- Terminating compromised instances immediately during incident triage without isolating volatile RAM state when addressing designing Terminating compromised instances immediately destroys volatile memory evidence (RAM dumps) required to establish intrusion timelines.
-
Injecting plaintext secrets into container environment variables rather than fetching from dynamic secret vaults
Container environment variables are visible via
docker inspector Kubernetes API queries, leaking sensitive API tokens to developers. - Failing to enforce automated credential rotation for third-party SaaS integration tokens Static long-lived API tokens shared across internal services represent the highest-probability vector for supply-chain credential compromise.