Building a DevSecOps pipelineModule 1: Foundations and your lab repository

Why the pipeline is the control point

What DevSecOps changes, which security check belongs in which pipeline stage, how to build a gate that teams keep switched on, and how pipeline output becomes evidence.

This lesson
QuestionsPass 7/10
Course26 items

In this lesson you will

  • Name the stages of a delivery pipeline and the security check that belongs in each
  • Explain the difference between a blocking gate and a report, and when each is right
  • Keep a new gate trusted by baselining, starting narrow and recording exceptions
  • Describe how pipeline output becomes evidence for frameworks such as the NIST SSDF and NIST SP 800-53

What DevSecOps changes

In a traditional release, security is a review at the end: a scan or a penetration test after the work is “done”. Findings arrive when the people who wrote the code have moved on, and fixing them means reopening finished work.

DevSecOps puts the checks inside the delivery process. The pipeline is the one path every change takes from a developer’s laptop to production, so it is the natural place to enforce rules that apply to every change. Nobody has to remember to run a scanner: the pipeline runs it, and the merge waits for the answer.

That is the idea behind the whole course: the pipeline is the control point.

The stages, and what belongs in each

Stage What happens Security check Module
Commit A developer commits locally Secret scanning in a pre-commit hook 2
Push and pull request Code reaches the shared repository Rulesets, required reviews, push protection, secret scanning 2
Build Code is compiled or packaged Static analysis (SAST) and dependency scanning (SCA) 3
Infrastructure Terraform or similar is planned IaC scanning and policy as code 4
Package A container image is built Image scanning, an SBOM, a signature, provenance 5
Deploy The artifact goes to an environment Short-lived credentials, approvals, signature verification 6
Test the running app The app runs in a test environment Dynamic testing (DAST) 6
Operate Production Logging, monitoring, rescanning for new CVEs 6

Each check runs at the earliest stage where it works reliably. A secret can be caught before it is committed; a missing security header can only be seen once the app is running.

A gate blocks; a report informs

There are two ways to wire in a check:

  • A gate fails the build. The change cannot merge or deploy until the finding is fixed or explicitly accepted.
  • A report records findings without stopping anything.

A gate forces a decision on every finding. A report does not, and reports nobody has to act on stop being read. When a check matters, make it a gate. Reports are still useful for things you are measuring but not yet enforcing, such as a new rule set you are trialling.

Keeping a gate trusted

Gates fail in one predictable way. They fire too often on things that do not matter, people learn to click past them, and eventually someone switches them off. Three habits prevent that:

  1. Gate on new findings, not the backlog. Record the existing findings as a baseline and block only what a change introduces. Fix the baseline on a schedule.
  2. Start narrow. Block on high and critical severity, or on a short list of rules you are sure about. Widen it once the team trusts it.
  3. Make exceptions explicit. An accepted risk is written down in the repository with a reason, an owner and an expiry date, and is reviewed like code. A finding is never silenced by deleting the check.

A useful measure of a gate’s health is its override rate: how often people bypass or suppress it. A rising rate means the gate is too noisy, not that the team is careless.

Pipeline output is evidence

Every pipeline run leaves records: which commit was built, which checks ran, what they found and who approved the deploy. Kept and retained, those records answer the questions an assessor asks.

  • NIST SP 800-218, the Secure Software Development Framework (SSDF), groups practices into four families: prepare the organization (PO), protect the software (PS), produce well-secured software (PW) and respond to vulnerabilities (RV). Repository rules and signing support PS; review, SAST and testing support PW; dependency scanning and rescans support RV.
  • NIST SP 800-53 Rev. 5, the catalogue behind FedRAMP: developer testing (SA-11), vulnerability scanning (RA-5), flaw remediation (SI-2), configuration settings (CM-6) and least privilege (AC-6) all leave pipeline evidence.
  • NIST SP 800-171, the requirements behind CMMC Level 2, maps the same way through configuration management, access control and audit.
  • DoD Enterprise DevSecOps guidance and DISA STIGs describe the same pipeline-as-control-point model and the hardening baselines artifacts are checked against.

A pipeline does not make a system compliant on its own; compliance also covers people, process and the environment. What a pipeline does is produce the same evidence every time, automatically, instead of someone assembling it by hand before an assessment.

Try it: classify a real pipeline

Pick any public repository you use, or one at work, and open its workflow files (.github/workflows/*.yml on GitHub). With the GitHub CLI you can list and read them without cloning:

# List workflow files in a repository
gh api repos/OWNER/REPO/contents/.github/workflows --jq '.[].name'

# Print one of them
gh api repos/OWNER/REPO/contents/.github/workflows/ci.yml \
  --jq '.content' | base64 -d

For each security-related step you find, write down:

Step Stage Gate or report? How would you know?
e.g. npm audit Build Report It runs with continue-on-error: true

Signs that a step is only a report: continue-on-error: true, || true at the end of a command, a scanner flag that always exits zero, or a job that is not a required status check. Most repositories have at least one check that looks like a gate and is not.

Key terms

  • SAST: static application security testing. Reads source code without running it.
  • SCA: software composition analysis. Checks third-party dependencies against known vulnerabilities and licences.
  • DAST: dynamic application security testing. Probes the running app from the outside.
  • IaC: infrastructure as code, such as Terraform.
  • SBOM: software bill of materials. A list of every component in an artifact.
  • Provenance: a record of how, where and from what an artifact was built.

Key takeaways

  • Every change already passes through the pipeline, so it is the one place a rule can apply to all of them.
  • Run each check at the earliest stage where it works reliably, but keep testing the running system too.
  • A check that cannot fail the build is a report, and reports nobody must act on stop being read.
  • Gate on new findings, start narrow, and write every exception down with an owner and an expiry date.
  • The same pipeline run that blocks a bad change also produces the evidence an assessor will ask for.

Lesson questions

Answer all 10, then check them. You need 7 right to pass this lesson and unlock the next one. Try as often as you like; after three tries the answers and explanations are shown. These are our own questions, written for this course.

  1. A team adds a dependency scanner to CI. It posts findings as a comment but the build still passes. Six months later nobody reads the comments. What was the design mistake?
  2. Which is the cheapest point to catch a hard-coded cloud access key?
  3. A new SAST gate fails 40 pull requests in its first week, most on old code nobody touched. What is the best next step?
  4. Repository rules and release signing produce evidence mainly for which SSDF practice group?
  5. Which statement about "shift left" is accurate?
  6. You review a workflow and find a scanner step whose command ends in '|| true'. What does that tell you?
  7. Over two months, the share of pull requests where developers suppress a gate's findings keeps rising. What does this most likely indicate?
  8. A missing HTTP security header is a real risk for your app. At which pipeline stage can it first be reliably detected?
  9. A team needs to accept a medium finding for now because the fix depends on a vendor release. What is the right way to record it?
  10. Which statement about pipelines and compliance does this lesson support?

Courses are taught against the frameworks they name. That is alignment, not certification: no course is certified, approved or endorsed by NIST, the DoD, DISA, FedRAMP, the CMMC program or any other agency or standards body, and completing one does not make a system compliant.