DevSecOps for SOC 2: The Pipeline Controls Auditors Check and the Evidence to Keep
Map CI/CD controls to SOC 2 change management, access and vulnerability criteria, configure branch protection and blocking scans, and collect evidence continuously.
Teams preparing for a first SOC 2 audit often treat it as a documentation exercise and are surprised by how much of it concerns the delivery pipeline. Auditors want to know that changes to production are authorized, reviewed, tested and traceable, that access is controlled, and that vulnerabilities are found and handled. For a software company, most of the proof for those points lives in source control and CI/CD.
That is good news. A well-built pipeline produces audit evidence as a side effect of normal work. This guide maps common pipeline controls to the SOC 2 criteria they support, shows how to configure them, and explains what evidence to keep. It is engineering guidance, not audit advice. Your auditor decides what satisfies a criterion for your organization, so confirm the mapping with them early.
How SOC 2 looks at a pipeline
SOC 2 reports are based on the AICPA Trust Services Criteria. The criteria never mention CI/CD by name. Three groups of the common criteria map closely to delivery work:
| Criteria group | Subject | Pipeline relevance |
|---|---|---|
| CC6 | Logical and physical access | Who can change code, pipelines and production, and how credentials are handled |
| CC7 | System operations | Detecting vulnerabilities and anomalies, and responding to them |
| CC8 | Change management | Changes are authorized, designed, tested, approved and implemented in a controlled way |
CC8.1 is the one most directly about the pipeline, and it is in scope for practically every SOC 2 engagement.
Type I and Type II
A Type I report assesses whether controls are suitably designed at a point in time. A Type II report assesses whether they operated effectively over a period, commonly several months to a year. The difference shapes the engineering work. For Type II it is not enough that branch protection is on today. You need to show it was on, and followed, for every production change in the window. That makes consistency and retained evidence more important than any single setting.
The controls and the evidence they produce
| Control | What to configure | Evidence to keep | Supports |
|---|---|---|---|
| Reviewed changes | Protected default branch, required pull request, at least one approval, stale approvals dismissed | Branch protection settings, pull request history with reviewers | CC8.1 |
| Segregation of duties | Author cannot approve their own change, code owners for sensitive paths | Review records, CODEOWNERS file history | CC8.1, CC6 |
| Tested changes | Required status checks for build and tests | Check results per merged commit | CC8.1 |
| Security testing | Secret, dependency, image and infrastructure code scanning in the pipeline | Scan logs, findings and remediation tickets | CC7.1, CC8.1 |
| Controlled deployment | Deployments only through the pipeline, approval gate for production | Deployment logs with commit, approver and time | CC8.1 |
| Restricted production access | No standing human write access, short-lived pipeline credentials | Role definitions, access reviews, session logs | CC6 |
| Strong authentication | Single sign-on and enforced multi-factor authentication for source control and cloud | Organization security settings, user list | CC6 |
| Secrets management | Secrets in a manager, not in code or plain CI variables, with rotation | Scanner results, rotation records | CC6 |
| Emergency changes | A documented fast path with after-the-fact review | Emergency change records and their reviews | CC8.1 |
| Vulnerability handling | Defined severity levels and remediation timelines | Tickets showing detection-to-fix times | CC7 |
Configure reviewed, tested changes
Define branch protection in code, so the control itself is version controlled and applied the same way to every repository. With the Terraform GitHub provider:
resource "github_branch_protection" "main" {
repository_id = github_repository.payments_api.node_id
pattern = "main"
enforce_admins = true
required_linear_history = true
allows_force_pushes = false
allows_deletions = false
required_pull_request_reviews {
required_approving_review_count = 1
dismiss_stale_reviews = true
require_code_owner_reviews = true
}
required_status_checks {
strict = true
contexts = ["build", "test", "security-scan"]
}
}
enforce_admins matters more than it looks. If administrators can bypass the rule, an auditor will ask how you know they did not. A CODEOWNERS file then routes sensitive paths to the right reviewers:
# Infrastructure and pipeline changes need platform team review
/terraform/ @example-org/platform
/.github/workflows/ @example-org/platform
# Authentication and payments code need a security reviewer
/src/auth/ @example-org/security
/src/payments/ @example-org/security
Requiring review on the workflow directory closes a common gap. A pipeline that enforces every control is of little value if anyone can edit the pipeline without review.
Add security testing that blocks
Scanning only counts as a control if it can stop a change and if findings are tracked to closure. A minimal set of pipeline steps:
# Secrets committed to the repository
gitleaks detect --source . --redact
# Known vulnerabilities in dependencies and the filesystem
trivy fs --severity HIGH,CRITICAL --exit-code 1 --ignore-unfixed .
# Misconfigurations in Terraform, Kubernetes manifests and Dockerfiles
trivy config --severity HIGH,CRITICAL --exit-code 1 .
# Vulnerabilities in the built image
trivy image --severity HIGH,CRITICAL --exit-code 1 --ignore-unfixed \
registry.example.com/payments-api:"$GIT_SHA"
Three practices make this defensible in an audit:
- Define the blocking threshold in a written policy, for example that critical and high findings with an available fix block a merge.
- Record exceptions. When a finding is accepted, record who approved it, why, and when it will be revisited. An unexplained ignore file is a finding in itself.
- Set remediation timelines by severity and keep the tickets. Auditors usually sample findings and check they were fixed within your own stated timeline.
Supply chain controls such as signed artifacts and a software bill of materials strengthen this further. The guide to pipeline security with SBOMs, SLSA and policy as code covers them.
Control the path to production
Three properties matter:
- One path. Production changes happen only through the pipeline. Human roles in production are read-only by default.
- An approval gate. A named approver, who is not the author, releases the production deployment. In GitHub this is an environment with required reviewers.
- Short-lived credentials. The pipeline assumes a role through federation, with no stored cloud keys. The CI/CD pipeline audit checklist includes a working example.
Infrastructure changes follow the same rule. A Terraform plan is reviewed in a pull request and applied by the pipeline, not from a laptop.
Emergency changes
Every team eventually needs to bypass the normal path during an incident. Auditors accept this when it is defined in advance. Document who can invoke it, how access is granted and logged, and that every emergency change gets a retrospective review within a fixed number of days. Then keep the records. An undocumented bypass is a control failure. A documented one that was reviewed afterward is the control working.
Collect evidence continuously
Reconstructing evidence at audit time is slow and unreliable. Collect it on a schedule and store it somewhere access-controlled.
# Current branch protection for a repository
gh api repos/example-org/payments-api/branches/main/protection > protection-$(date +%F).json
# Merged pull requests with author, reviewers and merge time
gh pr list --repo example-org/payments-api --state merged --base main --limit 500 \
--json number,title,author,mergedBy,mergedAt,reviews > merged-prs-$(date +%F).json
# Members without two-factor authentication
gh api "orgs/example-org/members?filter=2fa_disabled" --jq '.[].login'
A scheduled job that runs these across all in-scope repositories and writes to versioned, write-once storage gives you a dated record for the whole audit window.
Check retention as well. CI systems keep workflow logs for a limited period by default, which at the time of writing is 90 days on GitHub and is configurable on some plans. If your audit window is longer than your log retention, export deployment and scan logs to storage you control. The same applies to cloud audit logs.
Gaps that cause findings
| Gap | Why auditors notice | Fix |
|---|---|---|
| Protection on some repositories only | Auditors sample across repositories, and one unprotected production repository is a finding | Apply protection from code to every in-scope repository |
| Administrators can bypass rules | The control is not enforced for the most privileged users | Enforce for administrators and log any override |
| Author approves own change | No segregation of duties | Require an independent approver |
| Scans run but never block | The control detects without preventing, and findings accumulate | Set a blocking threshold and a tracked exception process |
| Direct production access for engineers | Changes can bypass the pipeline | Read-only by default, with time-limited elevation that is logged |
| Config and feature flag changes outside review | Production behavior changes with no record | Put configuration in version control and log flag changes |
| Evidence only from today | Type II needs proof across the period | Scheduled evidence collection from the first day of the window |
| No offboarding evidence | Access removal cannot be shown | Tie source control and cloud access to single sign-on and keep the records |
A realistic sequence
- Scope. List the repositories, pipelines, cloud accounts and people in scope. Keep development sandboxes out if you can justify it.
- Agree the control list with your auditor before building, so the mapping is not a surprise later.
- Enforce the basics everywhere: single sign-on, multi-factor authentication, branch protection and required reviews.
- Close the production access path: federated pipeline credentials, read-only human access and an approval gate.
- Add blocking security scans with a written threshold and exception process.
- Automate evidence collection and confirm log retention covers the window.
- Run for a few weeks, then self-audit. Sample ten merged changes and try to prove each was reviewed, tested, scanned, approved and deployed through the pipeline.
Step 7 is the most useful. If you cannot assemble the evidence for ten changes quickly, an auditor's sample will not go better.
CloudForge helps teams build these controls into delivery without slowing releases. See DevSecOps consulting for scope, and the SOC 2 pipeline hardening case study for an example engagement.
Sources
- Trust Services Criteria, AICPA
- About protected branches, GitHub Docs
- github_branch_protection resource, Terraform Registry
- About code owners, GitHub Docs
- Security hardening for GitHub Actions
Need these controls built into your pipeline?
CloudForge adds security checks, access controls and audit evidence to delivery pipelines without slowing releases.
See DevSecOps consulting