DevSecOps

Secure SDLC & DevSecOps

Security defects are cheapest to fix the earlier they are found, so the durable answer is to shift security left and automate it inside the pipeline rather than bolt it on after release. This lesson builds the mental model: weave security through every SDLC phase (with threat modeling as the highest-leverage activity), then walk the DevSecOps pipeline and what each control actually finds — SAST, DAST, IAST, SCA, secret/IaC/container scanning — plus supply-chain integrity (SBOM, SLSA, signing), the CI/CD attack surface itself (OWASP CI/CD Top 10, poisoned pipeline execution), why gates-on-everything fails culturally and guardrails-plus-targeted-gates wins, and the maturity models (SAMM, BSIMM, SSDF) that turn "do security better" into a measurable program.

The twelve pillars of Secure SDLC & DevSecOps

From why shift-left beats bolt-on to the maturity frameworks that make it measurable — each grounded in real standards, technique IDs, CVEs, and OWASP codes.

1

Why Secure SDLC & DevSecOps: shift-left, not bolt-on

Key points

  • Security defects are cheapest to fix the earlier they are found; bolting security on after release means expensive rework, emergency patches, and incidents. The SDLC integrates security activities into requirements, design, implementation, testing, and operations rather than as a final gate.
  • 'Shift-left' = move security activities earlier (toward developers and design) so issues are caught when they are cheap and contextual; DevSecOps extends this by automating those checks inside the CI/CD pipeline so every commit is evaluated.
  • DevSecOps = shared security responsibility across Dev, Sec, and Ops, with automated, fast, developer-facing feedback. The goal is to make the secure path the easy/default path, not to add friction.
  • NIST SP 800-218 (Secure Software Development Framework, SSDF v1.1) organizes practices into four groups: Prepare the Organization (PO), Protect the Software (PS), Produce Well-Secured Software (PW), and Respond to Vulnerabilities (RV) — a vendor-neutral baseline for what "secure SDLC" means.
  • Microsoft Security Development Lifecycle (SDL) is the classic industry reference that popularized phase-by-phase security activities (training, requirements, design/threat modeling, implementation, verification, release, response).

References

NIST SP 800-218
OWASP SAMM v2
Executive Order 14028
2

Security in every SDLC phase

Key points

  • Requirements: capture security and abuse/misuse requirements, compliance/privacy obligations, and define an acceptable-risk baseline before code exists (SSDF practice PW.1 — design software to meet security requirements and mitigate risks).
  • Design: perform threat modeling to find design-level flaws that no scanner catches — decompose the system, enumerate threats, and define mitigations. This lesson links to the threat-modeling process (/process), the STRIDE methodology (/stride), and secure-design principles (/secure-design).
  • Implementation: secure coding standards, code review, and developer security training (SSDF PO.2/PW.5/PW.7) reduce the rate of vulnerabilities entering the codebase.
  • Testing/Verification: automated SAST/DAST/SCA plus manual review and penetration testing validate that controls work (SSDF PW.7/PW.8).
  • Operations: monitoring, vulnerability disclosure, patch management, and incident response (SSDF RV.1–RV.3) close the loop; design-level flaws found in production feed back into the next threat model.
  • Threat modeling catches design flaws (e.g., missing authorization, insecure trust boundaries) that code scanners structurally cannot — making it the highest-leverage "shift-left" activity.

References

NIST SP 800-218
OWASP SAMM v2
3

The DevSecOps pipeline: what each control finds and where it runs

Key points

  • SAST (Static Application Security Testing): analyzes source/bytecode WITHOUT running it; finds injection, hardcoded secrets, unsafe APIs, taint-flow bugs. Runs early — IDE, pre-commit, and on pull-request in CI. High coverage but prone to false positives; cannot see runtime/config issues.
  • DAST (Dynamic Application Security Testing): tests a RUNNING application from the outside (black-box); finds issues visible at runtime such as reflected injection, auth/session flaws, and misconfigurations. Runs later — against a deployed test/staging environment. No source needed; slower, lower code coverage.
  • IAST (Interactive Application Security Testing): instruments the running app (agent inside the process) and observes code execution during functional/DAST tests; combines code-level visibility with runtime context to reduce false positives. Runs during integration/QA test execution.
  • SCA (Software Composition Analysis): inventories third-party/open-source dependencies and flags known-vulnerable versions and license risk; the primary defense for 'vulnerable and outdated components.' Runs at build/dependency-resolution time and continuously.
  • Secret scanning: detects committed credentials, API keys, and private keys in code/history; runs as pre-commit hook and in CI, ideally with push protection.
  • IaC scanning: checks Terraform/CloudFormation/Kubernetes manifests for insecure configuration (open security groups, public buckets, no encryption) before provisioning; runs on PR/CI.
  • Container image scanning: inspects image layers for vulnerable OS/app packages, embedded secrets, and misconfigurations; runs at image build and in the registry, with admission-time re-checks at deploy.

References

OWASP A06:2021
OWASP A05:2021
CWE-1104
4

SAST — static analysis depth

Key points

  • SAST performs data-flow/taint analysis from sources (untrusted input) to sinks (dangerous operations) to detect classes like SQL injection (CWE-89), cross-site scripting (CWE-79), path traversal (CWE-22), and unsafe deserialization (CWE-502).
  • It also flags hardcoded credentials (CWE-798) and use of broken/risky functions, and maps findings to OWASP/CWE so developers get remediation context.
  • Strengths: runs without executing code, full source coverage, earliest possible feedback (IDE/pre-commit/PR). Limitations: cannot see runtime config, environment, or authz logic intent — leading to false positives and false negatives; needs tuning and triage to avoid alert fatigue.
  • Representative tooling categories: pattern/AST-based (e.g., Semgrep) and query/dataflow engines (e.g., CodeQL), plus commercial scanners. Tool names are illustrative; the technique categories are the durable knowledge.
  • Best practice: run SAST on every pull request as a fast differential scan (only new/changed code) so reviews stay fast and findings stay actionable.

References

CWE-89
CWE-79
CWE-502
CWE-798
5

DAST & IAST — runtime testing

Key points

  • DAST exercises the deployed app over HTTP like an attacker, catching issues only visible at runtime: security misconfiguration (OWASP A05:2021), missing security headers, server-side injection reflected in responses, and broken authentication/session handling.
  • DAST needs no source code (good for third-party/black-box apps) but has limited coverage of code paths not reachable through the tested surface, and is slower — so it runs against staging/test deploys later in the pipeline.
  • IAST instruments the application from inside (an agent in the runtime) and watches actual code execution during functional or DAST-driven tests, correlating a runtime request to the exact vulnerable line — yielding lower false positives than SAST and better coverage context than DAST.
  • IAST requires a running, instrumented app and language/runtime support, so it fits integration/QA stages rather than pre-commit.
  • Combine them: SAST for breadth and early feedback, DAST for real runtime/config behavior, IAST to confirm exploitable paths during testing.

References

OWASP A05:2021
OWASP A07:2021
6

SCA & dependency / supply-chain risk

Key points

  • Modern apps are mostly third-party code; using components with known vulnerabilities is OWASP A06:2021 (Vulnerable and Outdated Components), and the underlying weakness class is CWE-1104 (Use of Unmaintained Third Party Components).
  • SCA builds a dependency graph (including transitive deps), matches it against vulnerability databases (CVE/NVD, GitHub advisories), and reports fixable upgrades; it also surfaces incompatible/risky licenses.
  • Log4Shell (CVE-2021-44228) is the canonical demonstration: a single transitive dependency exposed countless apps to remote code execution — SCA + an accurate SBOM is what lets you answer 'are we affected?' in minutes.
  • Supply-chain attack vectors include compromised packages and typosquatting (ATT&CK T1195.001 Compromise Software Dependencies and Development Tools) and broader build/distribution compromise (T1195.002 Compromise Software Supply Chain).
  • The xz/liblzma backdoor (CVE-2024-3094, 2024) shows maintainer-targeted social engineering inserting a backdoor into a trusted upstream — SCA on versions alone is insufficient; provenance and build integrity (next sections) matter.
  • SCA runs at dependency resolution/build time and continuously (new CVEs appear after release), feeding the vulnerability-management program (/vuln-management) and supply-chain governance (/governance).

References

OWASP A06:2021
CWE-1104
CVE-2021-44228
CVE-2024-3094
T1195.001
T1195.002
7

Secret scanning & secrets management in pipelines

Key points

  • Hardcoded credentials (CWE-798), inclusion of sensitive information in source code (CWE-540), and cleartext storage of secrets (CWE-312) are common, high-impact mistakes; leaked keys grant attackers Valid Accounts (ATT&CK T1078).
  • Secret scanning detects keys/tokens/private keys in code and git history; because git history is permanent, push protection (blocking the commit before it lands) is far better than after-the-fact detection — once pushed, a secret must be rotated, not just deleted.
  • Attackers harvest Unsecured Credentials (ATT&CK T1552), including Credentials In Files (T1552.001) and Private Keys (T1552.004) — CI configs, env files, and build logs are prime targets.
  • Pipeline secrets management best practice: never store long-lived secrets in repos or CI variables when avoidable; use short-lived credentials via OIDC workload identity federation (the CI runner exchanges a signed token for a cloud role), so there is no static cloud key to steal.
  • Where static secrets are needed, inject them at runtime from a dedicated secrets manager/vault with least-privilege scoping, audit logging, and rotation; mask secrets in logs to prevent leakage.
  • This maps to OWASP CI/CD Security risk CICD-SEC-6 (Insufficient Credential Hygiene).

References

CWE-798
CWE-540
CWE-312
T1078
T1552.001
T1552.004
8

IaC scanning & container image scanning

Key points

  • Infrastructure-as-Code scanning catches insecure configuration (OWASP A05:2021 Security Misconfiguration) before provisioning: public storage buckets, overly permissive security groups/firewall rules, disabled encryption, missing logging — shifting cloud misconfig left into the PR.
  • IaC scanning evaluates Terraform/CloudFormation/Kubernetes/Helm against policy; policy-as-code (e.g., OPA/Rego, admission policies) lets teams codify guardrails consistently. Tool/engine names are illustrative; the control is policy-driven config validation in CI.
  • Container image scanning inspects each layer for vulnerable OS and application packages (mapped to CVEs), embedded secrets, and bad Dockerfile practices (running as root, latest tags); it runs at build, in the registry, and re-validated at admission.
  • Use minimal/hardened base images (distroless/slim) and rebuild to pick up upstream patches — a stale base image silently reintroduces known CVEs. See container hardening in /container-security.
  • Container-specific attacker behavior to defend against: Implant Internal Image (ATT&CK T1525) and Deploy Container (T1610); registries and image provenance must be controlled, not just scanned.
  • Re-scan continuously: an image that passed last month may now contain newly disclosed CVEs — registry scanning and admission gates catch drift.

References

OWASP A05:2021
T1525
T1610
CWE-1104
9

Supply-chain integrity: SBOM, SLSA, signing

Key points

  • An SBOM (Software Bill of Materials) is a machine-readable inventory of every component in a build; it is what makes incident response to a new CVE (e.g., Log4Shell) fast — you query the SBOM instead of guessing. Driven into policy by US Executive Order 14028.
  • Standard SBOM formats: SPDX, standardized as ISO/IEC 5962:2021, and CycloneDX (an OWASP project). Generate the SBOM as a build artifact, not by hand.
  • SLSA (Supply chain Levels for Software Artifacts) v1.0 defines a Build Track with levels L1–L3 of increasing build-integrity assurance: L1 = provenance exists, L2 = signed provenance from a hosted build service, L3 = hardened, non-falsifiable provenance from an isolated build. It targets tampering between source and consumer.
  • Build provenance is commonly expressed as in-toto attestations describing how/where/from-what an artifact was built, so consumers can verify it came from the expected pipeline.
  • Artifact signing (e.g., Sigstore / cosign) lets you cryptographically verify that an artifact/image is the one your pipeline produced and was not swapped — defending against tampered artifacts (OWASP CICD-SEC-9 Improper Artifact Integrity Validation).
  • This is the integrity half of OWASP A08:2021 (Software and Data Integrity Failures); the SolarWinds SUNBURST campaign — a trojanized build of the Orion DLL injected through a compromised build system (a supply-chain code implant; no CVE) — is the textbook case that motivated build provenance and signing. (The separately tracked CVE-2020-10148 is an unrelated Orion API authentication-bypass weakness that let opportunistic actors deploy the SUPERNOVA .NET webshell; it is NOT SUNBURST.) NIST SP 800-161r1 (C-SCRM) and SP 800-204D give the supply-chain control guidance; deeper coverage lives in /governance.

References

ISO/IEC 5962:2021
OWASP A08:2021
NIST SP 800-161
Executive Order 14028
CVE-2020-10148
10

Pipeline integrity: the CI/CD attack surface (OWASP CI/CD Top 10, PPE)

Key points

  • The CI/CD system is itself high-value: it has broad credentials, write access to artifacts/registries, and deploy rights. OWASP maintains a dedicated Top 10 CI/CD Security Risks (CICD-SEC-1 through CICD-SEC-10) for exactly this surface.
  • Poisoned Pipeline Execution (PPE) — OWASP CICD-SEC-4 — is when an attacker who can influence build config or scripts (e.g., a malicious PR that modifies the pipeline definition, or an untrusted dependency run during build) gets arbitrary code execution inside the pipeline (ATT&CK T1059 Command and Scripting Interpreter), then steals CI secrets and pivots.
  • Other key risks: CICD-SEC-1 Insufficient Flow Control, CICD-SEC-2 Inadequate IAM, CICD-SEC-3 Dependency Chain Abuse, CICD-SEC-5 Insufficient Pipeline-Based Access Controls, CICD-SEC-6 Insufficient Credential Hygiene, CICD-SEC-9 Improper Artifact Integrity Validation, CICD-SEC-10 Insufficient Logging and Visibility.
  • Attack paths leverage Valid Accounts (T1078) and Trusted Relationship (T1199) — a compromised pipeline is a trusted insider to every downstream system; defenders should treat the build system as production. (See /attack-paths.)
  • Hardening: don't run untrusted PR code with secrets present; require manual approval for fork PRs; scope runner permissions to least privilege; isolate/ephemeral runners; pin actions/dependencies by digest; and log/monitor pipeline activity (CICD-SEC-10) to detect tampering.
  • The Codecov bash-uploader compromise (2021) is a real-world example of CI tooling being subverted to exfiltrate secrets from customers' pipelines — illustrating why pipeline integrity, not just app code, must be defended.

References

T1059
T1078
T1199
OWASP A08:2021
11

Gates vs guardrails — and why blocking on every finding fails culturally

Key points

  • A gate is a hard, blocking control (build fails / deploy stops) when a policy threshold is violated; a guardrail is a non-blocking control that informs, nudges, or auto-fixes while letting the developer proceed.
  • Blocking the build on every finding fails culturally: scanner false positives plus low-severity noise train developers to see security as an obstacle, leading to alert fatigue, bypasses, and disabled checks — net security goes down.
  • Effective model: guardrails by default (visibility, education, auto-PRs for dependency bumps), and gates reserved for high-confidence, high-severity, policy-defined conditions (e.g., a critical exploitable vulnerability, an exposed secret, a failed signature verification).
  • Use differential/PR-scoped gating (block on NEW critical findings, not the entire legacy backlog) so teams can adopt scanning without an impossible day-one cleanup, and so the signal stays high.
  • Risk-accept with an audit trail: provide a governed exception/waiver path with expiry and ownership so blocked-but-justified cases don't become silent bypasses. Measure mean-time-to-remediate, not just finding counts.
  • Guardrails plus targeted gates is how DevSecOps scales: security becomes the default easy path instead of a wall developers route around.

References

OWASP SAMM v2
NIST SP 800-218
12

Maturity models & frameworks: SAMM, BSIMM, SSDF

Key points

  • OWASP SAMM v2 (Software Assurance Maturity Model) is a PRESCRIPTIVE self-assessment model across five business functions — Governance, Design, Implementation, Verification, Operations — each with practices scored at maturity levels 1–3, used to build an improvement roadmap.
  • BSIMM (Building Security In Maturity Model; current release BSIMM16) is a DESCRIPTIVE model: it observes and measures what real organizations actually do across four domains — Governance, Intelligence, SSDL Touchpoints, Deployment — letting you benchmark against peers rather than against an ideal.
  • Use them together: SAMM tells you what you SHOULD do (target state), BSIMM tells you what others DO (benchmark) — neither is a checklist of mandatory controls.
  • NIST SP 800-218 (SSDF v1.1) is the U.S. government reference framework of secure-development practices (PO/PS/PW/RV) mandated for federal software suppliers via Executive Order 14028; NIST SP 800-218A extends it to generative-AI software.
  • NIST SP 800-204D ('Strategies for the Integration of Software Supply Chain Security in DevSecOps CI/CD Pipelines') gives concrete pipeline/supply-chain control guidance, complementing SP 800-161r1 (C-SCRM).
  • Pick a framework, baseline current maturity, set target levels, and iterate — maturity models turn 'do security better' into a measurable, prioritized program.

References

OWASP SAMM v2
NIST SP 800-218
Executive Order 14028

Threat modeling is the highest-leverage shift-left

Scanners structurally cannot catch design-level flaws like missing authorization or insecure trust boundaries — that is what threat modeling is for. See how STRIDE decomposes a system and enumerates threats so you can mitigate them before a single line of code exists.