Notes
The whole pipeline
Here is the whole map. In the editor and at commit: secret scanning, linters and fast static analysis. On the pull request: fuller static analysis and infrastructure-as-code scanning. In the build: dependency scanning, image scanning, a software bill of materials, and signing the artifact. Before deploy: a policy gate and config checks. At runtime: dynamic testing, monitoring and drift detection. The principle: run each check at the stage where it is cheapest and gives feedback fastest.
- IDE / pre-commit: secrets, linters, fast SAST
- pull request: SAST, IaC scan
- build: SCA, image scan, SBOM, sign artifacts
- pre-deploy: policy gate, config checks
- runtime: DAST, monitoring, drift detection
- each check runs where it is cheapest and fastest
Shift all the way left
The furthest left is the developer's own machine. Editor plugins flag issues as code is typed, and pre-commit hooks block secrets and obvious problems before they are even committed. This is the cheapest possible feedback, measured in seconds. Two cautions: these checks must be fast, or developers disable them; and local hooks can be bypassed, so anything that matters must also run in the pipeline, where it cannot be skipped. Local checks are for speed and convenience; the pipeline is for enforcement.
- IDE plugins: flag issues as code is typed
- pre-commit hooks: block secrets and obvious bugs before they are committed
- fast: must run in seconds, or it gets disabled
- this is the cheapest place to catch anything
- but local hooks can be skipped, so repeat in CI
The pull request gate
The pull request is where most automated security feedback should land, because it matches how developers already work: they expect checks on a PR. Run static analysis and infrastructure scanning on the diff, comment findings inline on the changed lines, and block the merge only on new high or critical issues. Baseline existing findings so you are not relitigating the backlog on every change. And keep it under a few minutes, because a slow gate is one developers route around.
- run SAST and IaC scanning on the diff
- comment findings inline on the changed lines
- block merge on NEW high or critical issues only baseline existing findings; do not relitigate them
- keep it under a few minutes so it does not block flow
The build stage
The build stage is where supply-chain security lives, the main theme of this part. Here you scan dependencies for known vulnerabilities, generate a software bill of materials recording what is inside the artifact, scan the container image, and sign the artifact and its bill of materials so their origin can be verified later. Fail the build on new critical issues in dependencies your code actually uses. Cache scan results so builds stay fast. These steps stop you shipping someone else's vulnerability.
- SCA: scan dependencies for known vulnerabilities
- generate an SBOM (what is inside this artifact)
- scan the container image
- sign the artifact and its SBOM (provenance)
- fail on new criticals in reachable dependencies
- cache scans so the build stays fast
Deploy and runtime
At deploy, a policy gate makes the final decision: is this image signed, was it scanned, is its config compliant? In Kubernetes this is admission control, often backed by Open Policy Agent, which episode eleven covers. After deploy, dynamic testing runs against staging, monitoring watches the running system, and drift detection catches config that has wandered from what was declared. Because infrastructure is defined as code, its config is reviewed like any other code. No single stage is enough; they layer.
- pre-deploy policy gate: is the image signed? scanned? config compliant? (OPA, admission control)
- runtime: DAST against staging, monitoring, config drift
- infra-as-code means config is reviewed like code
- defence in depth: do not rely on one stage alone
Block or warn
The hardest decision in DevSecOps is when a finding should actually stop the pipeline. Block on the clear, serious things: new critical vulnerabilities, committed secrets, unsigned artifacts, a failed policy check. Warn on lows, mediums and existing findings. Always give an override path with a recorded, reviewable reason, for the genuine emergency. The balance matters: a gate that blocks too much gets disabled, and a gate that blocks nothing protects nothing.
- block on: new criticals, secrets, unsigned artifacts, failed policy
- warn on: lows, mediums, existing findings
- always give an override path with a recorded reason
- a gate that blocks too much gets disabled
- a gate that blocks nothing protects nothing
Keep it usable
Whether all this helps comes down to whether developers trust it, which means fast and low-noise. Keep it fast by parallelising, caching and scanning diffs. Keep it low-noise by tuning tools, baselining and deduplicating. Turn findings into tickets with owners, not walls of log output. Measure what matters: time to fix, escaped bugs, and the false-positive rate. And the culture point: security is everyone's job, and the pipeline is how a small security team enforces it at scale.
- fast: parallelise, cache, scan diffs not everything
- low-noise: tune tools, baseline, dedupe
- findings become tickets with owners, not just logs
- measure: time to fix, escaped bugs, false-positive rate
- security is everyone's job, the pipeline just enforces it
Common mistakes
Mistakes. Bolting every scan onto the end of the pipeline, where it is slow and ignored, instead of spreading checks across stages. Blocking on every low finding, which trains people to disable the gate. Dumping the entire backlog of old findings on developers at once instead of baselining. Scans so slow that teams route around them. No owner assigned to findings, so they rot. And putting checks only in local hooks, which can be skipped, rather than enforcing them in the pipeline where they cannot.
- bolting all scans on at the end, slow and ignored
- blocking on every low finding
- dumping old findings on developers at once
- scans so slow the pipeline is bypassed
- no owner for findings
- checks only in local hooks, skippable in CI
Say it like this
In the interview: I put each check at the stage where it is cheapest. Secret scanning and quick static analysis at commit. Fuller static analysis and infrastructure scanning on the pull request. Dependency scanning, image scanning, a bill of materials and signing at build. A policy gate before deploy that checks the image is signed and compliant. Dynamic testing and monitoring at runtime. I block only on new criticals, secrets and failed policy, baseline the rest, and keep the pipeline fast and low-noise.
- "Each check at the cheapest
- stage: secrets and fast SAST
- at commit, SAST and IaC on the PR, SCA, image scan, SBOM and signing at build, a policy
- gate before deploy, DAST and monitoring at runtime. Block
- on new criticals and secrets, baseline the rest, and keep
- it fast and low-noise."