DevSecOps
Vault, Trivy, SonarQube, OPA, Kyverno, Falco β security at every stage
Category: DevSecOps
Learning Path: What β Why β Learning Modules β Production Example β Interview Prep
Before you start: general CI/CD pipeline familiarity (what a build stage and a deploy stage are) is assumed, along with basic container/Kubernetes concepts. [Cloud Security](/academies/security/cloud-security/overview) and [Pen Testing](/academies/security/pen-testing/overview) cover related but distinct ground β this page is specifically about embedding security checks into the delivery pipeline itself.
What is DevSecOps?
Shift-left means catching security issues as early as possible β in the developer's editor or at commit time, not in production. The cost of fixing a vulnerability grows 10x at each stage: dev β PR β build β staging β production. A complete DevSecOps pipeline has security gates at every stage. No single tool covers everything β defense in depth.
Why This Exists (The Hook)
A security review held once, right before a production release, finds every issue at the single most expensive point to fix them β the code is already written, reviewed, tested, and scheduled to ship, so a critical finding now means reopening work that was considered done. DevSecOps exists because most of that cost is avoidable: the same categories of issues (a hardcoded credential, a vulnerable dependency, a misconfigured container) are just as detectable at commit time or build time, when fixing them costs minutes instead of a delayed release.
Analogy β Think of DevSecOps like a car factory's quality checks at every station on the line, not one final inspection before the car leaves the lot. A factory that only inspects finished cars discovers a bad weld after the whole car is assembled around it β expensive to fix, sometimes requiring a full teardown. A factory that checks the weld right after it's made catches the same defect in seconds, at the one station where it's cheapest to fix. DevSecOps puts a "quality check station" (a security gate) at commit, at PR, at build, at deploy, and at runtime β instead of one inspection at the very end.
Try it (2 minutes) β Reason through why CRITICAL Trivy findings block the build outright while HIGH findings only create a tracked ticket, without looking anything up: if every single finding, regardless of severity, blocked every build, what would that do to how quickly and how carefully developers respond to critical findings specifically β and what usually happens to alert systems that cry wolf on low-stakes issues as often as high-stakes ones?
Why DevSecOps?
Vault is the industry standard for secret management. Two types of secrets: Static (username/password stored in Vault's KV store) and Dynamic (Vault generates short-lived credentials on demand β database, AWS keys, TLS certs). Dynamic secrets are the killer feature β no shared passwords, automatic expiry, full audit trail. Vault Agent Injector automatically injects secrets into pods at startup with zero code changes.
Learning Modules
Module 01 β DevSecOps Pipeline
Shift-left security β every stage
Shift-left means catching security issues as early as possible β in the developer's editor or at commit time, not in production. The cost of fixing a vulnerability grows 10x at each stage: dev β PR β build β staging β production. A complete DevSecOps pipeline has security gates at every stage. No single tool covers everything β defense in depth.
Topics covered:
Module 02 β HashiCorp Vault
Secret management, dynamic credentials
Vault is the industry standard for secret management. Two types of secrets: Static (username/password stored in Vault's KV store) and Dynamic (Vault generates short-lived credentials on demand β database, AWS keys, TLS certs). Dynamic secrets are the killer feature β no shared passwords, automatic expiry, full audit trail. Vault Agent Injector automatically injects secrets into pods at startup with zero code changes.
Topics covered:
Module 03 β Trivy & Container Security
CVE scanning, image hardening
Trivy is the most popular open-source vulnerability scanner β scans OS packages, language dependencies, Dockerfile misconfigs, and IaC. Critical CVEs block the build. High CVEs create Jira tickets but allow the build. The best way to reduce vulnerabilities: use minimal base images (distroless, alpine, scratch), run as non-root, set read-only root filesystem. Fewer packages = fewer vulnerabilities.
Topics covered:
Module 04 β SonarQube
SAST, quality gates, code coverage
SonarQube is the leading SAST (Static Application Security Testing) platform. Finds bugs, security vulnerabilities, and code smells before runtime. Quality Gate is the pass/fail threshold β build fails if coverage drops below 80% or critical security issues are introduced. In CI/CD: code pushes β SonarQube analysis β Quality Gate result β pass or block PR merge.
Topics covered:
Module 05 β OPA Gatekeeper & Kyverno
Policy as Code for Kubernetes
Admission controllers intercept every API request to Kubernetes and can allow, deny, or mutate it. OPA Gatekeeper uses Rego policy language (powerful but complex). Kyverno uses YAML-native policies (simpler, easier to read). Common production policies: require resource limits, block containers running as root, block latest image tag, restrict to approved registries, require labels for all workloads.
Topics covered:
Module 06 β Falco β Runtime Security
Real-time threat detection in containers
Falco is a runtime security tool β it watches what actually happens inside containers and alerts on suspicious behaviour. Uses eBPF probes or kernel module to observe system calls. Built-in rules detect: shell spawned in container, file write to /etc, privilege escalation, crypto miners, network scanners. Cannot be evaded by modifying the container image β it watches kernel-level calls.
Topics covered:
Production Example
Interview Prep
PSR Formula: Answer every question: Problem β Solution β Result. 45-90 seconds max.
Common Interview Questions
Q1. What is DevSecOps and why would you use it in production?
A: Problem: treating security as a final gate right before production means vulnerabilities get caught after most of the cost (design, implementation, review) has already been sunk β the cost of fixing an issue grows roughly 10x at each stage from dev through production. Solution: DevSecOps shifts security checks left, embedding gates at every stage β pre-commit secret scanning, PR-time SAST/IaC scanning, build-time image scanning, deploy-time admission policies, and runtime threat detection β rather than one late-stage security review. Result: issues get caught when they're cheapest to fix, and no single tool needs to catch everything, since defense-in-depth means a gap at one stage is likely caught at another.
Q2. How does a DevSecOps pipeline work internally? Explain the architecture.
A: Problem: understanding how the different tools at each stage actually fit together (rather than being a random collection) matters for reasoning about coverage gaps. Solution: each stage's tools address a genuinely different risk window β pre-commit tools (detect-secrets, gitleaks) prevent secrets from ever entering history; PR-stage tools (SonarQube, Checkov, tfsec) catch code and IaC issues before merge; build-stage tools (Trivy, Snyk) catch dependency/image vulnerabilities; deploy-stage admission controllers (OPA Gatekeeper, Kyverno) enforce policy on what's actually allowed to run; runtime tools (Falco) catch what static analysis structurally can't β actual anomalous behavior once something is already running. Result: this is why "no single tool covers everything" isn't a limitation to work around, it's the actual design β each stage catches a different class of risk the others structurally can't.
Q3. What are the main components of a complete DevSecOps toolchain?
A: Problem: "DevSecOps" names a genuinely large set of distinct tool categories worth separating. Solution: secrets management (Vault β static and dynamic secrets), vulnerability/dependency scanning (Trivy, Snyk), static code analysis (SonarQube), IaC misconfiguration scanning (Checkov, tfsec), Kubernetes admission policy enforcement (OPA Gatekeeper, Kyverno), and runtime threat detection (Falco). Result: knowing which category addresses which risk is what lets a team build genuine defense-in-depth rather than redundantly covering one risk category five times while leaving another (like runtime behavior) completely unaddressed.
Q4. How do you handle failures/findings across a multi-stage DevSecOps pipeline?
A: Problem: treating every finding at every stage as an identical hard block produces both alert fatigue and inconsistent enforcement across stages. Solution: per this guide's own pattern, CRITICAL CVEs block the build outright while HIGH severity creates a tracked ticket without blocking β a deliberate severity-based triage rather than all-or-nothing gating; admission-time policy violations (Kyverno/OPA) block deployment outright since they represent a defined, non-negotiable policy; runtime alerts (Falco) go to incident response rather than blocking anything retroactively, since the workload is already running. Result: each stage's appropriate failure response differs β a build-time gate can block; a runtime detection can only alert and trigger response, since there's nothing left to "block" once something is already deployed and running.
Q5. What is your production experience with DevSecOps?
A: This is a genuinely personal question β answer with a real incident using the Problem β Solution β Result structure: a Trivy/SonarQube finding caught before a bad deploy, tuning an admission policy that was initially too strict or too permissive, or a Falco alert that surfaced genuinely suspicious runtime behavior. Interviewers are listening for whether you've actually operated a multi-stage security pipeline under real delivery pressure, not just read about each tool individually.
Q6. How do you monitor and keep a DevSecOps pipeline effective over time?
A: Problem: a pipeline with security gates configured once at adoption can drift out of calibration as the codebase and threat landscape both evolve. Solution: track Quality Gate/scan pass rates over time (consistently failing suggests miscalibration; never failing suggests the gate isn't adding real value), periodically re-audit .trivyignore/accepted-risk lists for findings that now have available fixes, and treat Falco/runtime alert volume as its own signal β a sudden spike deserves investigation regardless of whether any single alert looks routine. Result: DevSecOps tooling, like any security control, needs periodic recalibration β a "configure once" mindset lets both false-positive fatigue and genuine coverage gaps grow unnoticed over time.
Q7. What are the security considerations for the DevSecOps tooling itself, not just what it's scanning?
A: Problem: the security tools themselves (Vault, SonarQube, the admission controller) become high-value targets, since compromising them can undermine every downstream security check they're meant to provide. Solution: Vault's own root token should be locked away post-setup with day-to-day access via scoped policies; SonarQube/Trivy findings (which describe exploitable weaknesses) deserve the same access control as any other sensitive security data; and admission controller policies themselves need change control, since a modified/disabled policy silently removes a deploy-time safety net without anyone necessarily noticing immediately. Result: the tools enforcing security need to be treated with at least the same rigor as the systems they protect β a compromised or misconfigured security tool is a single point of failure for the whole defense-in-depth model.
Q8. How does a shift-left DevSecOps approach compare to a traditional, late-stage security review model?
A: A traditional model concentrates security review at one late gate (often right before production), meaning issues found there are the most expensive to fix (already implemented, already reviewed, already tested) and create a real bottleneck right when a team is trying to ship. Shift-left distributes checks across every stage, catching the same classes of issues far earlier and cheaper, at the cost of needing more tools integrated across more stages of the pipeline rather than one centralized review process β a real tooling/process investment tradeoff, not a free improvement.
Q9. Why are dynamic secrets described as Vault's "killer feature," beyond just being more convenient than static ones?
A: A static secret (a shared username/password stored in Vault's KV store) still carries the same fundamental risk as any long-lived credential β indefinite validity until someone manually rotates it. Dynamic secrets are generated on-demand, short-lived, and automatically expire/revoke β meaning a leaked dynamic credential has a bounded, generally short useful lifetime by design, with a full audit trail of exactly when and to what it was issued. This is a genuinely different security posture, not just a convenience feature β it removes the "did someone remember to rotate this" dependency entirely for the secrets it covers.
Q10. Walk through the complete security gate flow for a code change from commit to production, per this guide's own defense-in-depth model.
A: At commit time, pre-commit hooks (detect-secrets, gitleaks) block credential leaks before they ever enter Git history. At PR time, SonarQube SAST and Checkov/tfsec IaC scanning run automatically, surfacing code-quality/security and infrastructure-misconfiguration issues directly on the PR. At build time, Trivy scans both source dependencies (filesystem scan) and the built container image, with CRITICAL CVEs blocking the build outright. At deploy time, Kyverno or OPA Gatekeeper admission policies enforce non-negotiable rules (no root containers, required resource limits, approved registries only) before anything is admitted to the cluster. At runtime, Falco monitors for genuinely suspicious behavior the earlier static stages couldn't have caught, while Vault provides the dynamic secrets those running workloads need without any long-lived static credential ever existing in the first place.

