LOOP · The DevOps Codex
Ch 16 · DevSecOps
Chapter 16 · Security in the Pipeline

DevSecOps — shift-left, sign everything, prove provenance

After Log4Shell (2021), the SolarWinds compromise (2020), and the xz-utils backdoor (2024), the industry stopped pretending security could be bolted on at the end. DevSecOps embeds checks into every stage — SAST in the IDE, SCA on every PR, container scans at build, signed attestations at release, policy-as-code at admission. This chapter maps the toolchain in 2026 and the frameworks the auditors will ask about.

16.1 · Shift-left security

Definition. Shift-left is the practice of moving security checks as early in the SDLC as possible — IDE → commit → PR → build → deploy → run — so issues are found when they are cheap to fix, not in production.

IDEcommit/PRbuilddeployprod cheap ~100× more costly cost to fix vs stage discovered

Studies dating back to NIST SP 500-204 (1980s) and updated by Capers Jones / IBM Systems Sciences place the production-fix cost at roughly two orders of magnitude above the IDE-fix cost. Shift-left is the structural response.

16.2 · SAST — Static Application Security Testing

Definition. SAST analyses source code (or compiled bytecode) for vulnerability patterns without executing it.

ToolOwnerNotes
SemgrepSemgrep Inc. (OSS + Pro)Pattern rules in YAML; very fast; 2k+ community rules.
CodeQLGitHub (GitHub Advanced Security)Datalog-style query; deep dataflow; the engine behind Default Setup.
SonarQube / SonarCloudSonarSourceQuality + security; SonarLint IDE.
Snyk Code / Checkmarx One / VeracodecommercialML-augmented · unified SAST+SCA+IaC · binary analysis.

16.3 · DAST — Dynamic Application Security Testing

Definition. DAST attacks a running application from the outside (HTTP/API) to find runtime vulnerabilities the source view can't see (auth, session, misconfigurations).

ToolNotes
OWASP ZAP / Burp SuiteOSS de-facto (zap-baseline.py); PortSwigger pen-tester standard with Enterprise CI mode.
Invicti / Nuclei / AppCheckEnterprise proof-based · OSS template scanner · UK commercial DAST.

16.4 · IAST & RASP

IAST (Interactive AST) instruments the running app like an APM agent and observes vulnerabilities during functional tests. RASP (Runtime Application Self-Protection) stays in production and blocks attacks live.

ToolClassNotes
Contrast SecurityIAST + RASPJava/.NET/Node agents; production-safe.
Seeker / OpenRASP / Imperva RASPIAST & RASPQA-suite IAST · OSS JVM/PHP RASP · WAF-vendor RASP.

16.5 · SCA — Software Composition Analysis

Definition. SCA inspects your declared dependencies (manifests + lockfiles) and matches them against vulnerability databases (NVD, GHSA, OSV) and licence catalogues.

ToolNotes
GitHub DependabotFree on GitHub; alerts + auto-PRs (GHSA).
Snyk OSS / Renovate / OSV-ScannerBroad ecosystem; group/schedule rules; OSV.dev DB + GH Action.
Mend / Trivy SCA / SonatypeEnterprise licence policy · OSS multi-target · repo+policy.

16.6 · Secret scanning

ToolNotes
gitleaksOSS; pre-commit + CI; regex + entropy.
trufflehog / GitGuardianOSS verifies tokens against provider APIs; GitGuardian adds honeytokens + org coverage.
GitHub Secret Scanning & Push Protection · GitLab Secret DetectionBuilt-in to host; blocks pushes containing known token formats.
If it ever hit Git, rotate it. Even after rewriting history, you must assume the secret leaked. Push-protection is the only way to stop the bleed at source.

16.7 · Container scanning

ToolOwnerNotes
Trivy · Syft+GrypeAqua · Anchore (OSS)De-facto OSS scanners; Syft = SBOM, Grype = scan.
Snyk Container / Anchore EnterpriseSnyk · AnchoreBase-image upgrade suggestions; policy gates + registry integration.
Sysdig Secure / Aqua / Wizcommercial CNAPPRuntime + image + cloud posture; Wiz agentless.

16.8 · IaC scanning

ToolNotes
Checkov (Bridgecrew → Prisma Cloud)OSS; Terraform, CFN, K8s, ARM, Bicep, Helm.
Terrascan / KICS / Snyk IaC / Prisma CloudOSS & enterprise — Rego-backed, multi-IaC, PR remediation, posture-combined.

16.9 · Supply-chain security — SBOM · SLSA · Sigstore

Definition. A software supply chain is every input that becomes part of (or builds) your artefact: source, dependencies, base images, compilers, build runners. Securing it means generating evidence at build time and verifying it at deploy time.

StandardWhat it isStatus
SBOMMachine-readable inventory of components.Formats: SPDX 3.0 (ISO/IEC 5962), CycloneDX (OWASP).
SLSABuild-integrity maturity model L1–L4.v1.0 (2023), v1.1 (2024); slsa.dev.
SigstoreKeyless signing via OIDC.Cosign (CLI), Fulcio (CA), Rekor (transparency log), Gitsign (commits) — OpenSSF.
in-toto / ProvenancePer-step attestation framework + build provenance.CNCF in-toto 2023; npm provenance, PyPI Trusted Publishers (2023), GitHub artifact attestations (GA 2024).
EU CRACyber Resilience Act (adopted 2024).SBOM & vulnerability handling mandatory by ~2027.
SLSA levelBuild integrity requirement
Build L1 → L3L1: provenance exists. L2: signed by hosted build platform. L3: hardened, isolated builder; tamper-resistant provenance.
# Sign and verify a container image, keyless (OIDC)
cosign sign ghcr.io/acme/api:v1.4.2
cosign verify ghcr.io/acme/api:v1.4.2 --certificate-identity-regexp 'https://github.com/acme/.+' --certificate-oidc-issuer https://token.actions.githubusercontent.com

16.10 · Policy-as-code

ToolLanguageScope
OPA / Conftest (CNCF graduated)RegoUniversal policy engine; Conftest evaluates config files in CI.
Kyverno (CNCF graduated 2024)YAMLKubernetes-native; easier than Rego for K8s.
Cedar (AWS, OSS 2023)CedarAWS Verified Permissions; fine-grained authz.

16.11 · Admission control on Kubernetes

Definition. An admission controller is a webhook K8s calls before persisting an API object. It can validate (allow/deny) or mutate (rewrite). It's the choke point where policy-as-code lives.

  • Kyverno — YAML policies; mutating + validating; Cosign image-signature verification built-in.
# Kyverno — require signed images from your org
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata: { name: verify-images }
spec:
  validationFailureAction: Enforce
  rules:
    - name: check-signature
      match: { any: [{ resources: { kinds: [ Pod ] } }] }
      verifyImages:
        - imageReferences: [ "ghcr.io/acme/*" ]
          attestors:
            - entries:
              - keyless: { subject: "https://github.com/acme/*", issuer: "https://token.actions.githubusercontent.com" }

16.12 · SBOM in CI

  • Generate at build — syft packages dir:. -o spdx-json > sbom.spdx.json or trivy sbom; attach as an OCI artefact (cosign attach sbom) or a GitHub artifact attestation.
  • Scan continuously — grype sbom:./sbom.spdx.json against fresh vuln DBs; rescan even when nothing rebuilds (new CVEs match yesterday's artefacts).

16.13 · Compliance frameworks the pipeline maps to

FrameworkWhat & yearPipeline mapping
SOC 2 Type IIAICPA Trust Services Criteria, attestation report over 6–12 months.Access reviews, change mgmt evidence, monitoring + IR.
ISO/IEC 27001:2022ISMS standard (revised 2022).Risk register, Annex A 93 controls.
EU CRACyber Resilience Act; adopted 2024.SBOMs, vuln-handling, 24h disclosure for actively exploited.
NIST SSDF SP 800-218Secure SDF; required for US-gov suppliers.Maps directly to CI/CD practices.

16.14 · Anti-patterns

  • Security as a gate at the end. Pen-test the week before launch is too late and too political.
  • Vulnerability fatigue. 10 000 open Highs ≈ zero open Highs. Rank by exploitability + reachability (EPSS, runtime presence).
The xz-utils lesson (CVE-2024-3094). A multi-year social-engineering campaign placed a backdoor in a near-ubiquitous OSS library via a trusted maintainer hand-off. SBOMs, SLSA provenance, and reproducible builds turned weeks of incident response into a quick blast-radius assessment.

16.15 · Self-check

Q1 · Which Sigstore component issues short-lived signing certificates bound to an OIDC identity?
Cosign
Fulcio
Rekor
Gitsign
Q2 · Which scan type instruments a running application and observes vulnerabilities during functional tests?
SAST
SCA
IAST
DAST
Q3 · You want to block any pod in your K8s cluster whose image is not signed by your GitHub org's OIDC identity. The simplest 2026 path is:
A PodSecurityPolicy (PSP) rule
A Kyverno ClusterPolicy with verifyImages + Cosign keyless
A NetworkPolicy
A namespace label