On this page

CI CD pipeline security, also written CI/CD pipeline security, is the work of protecting the system that builds, tests and deploys your code. Start with five controls: short-lived, least-privilege credentials for every pipeline identity; pinned and verified third-party actions and dependencies; protected branches with required review; secrets kept out of code and logs; and signed build artifacts that are verified before deploy.

This guide maps those controls to the ten risks that OWASP, the Open Worldwide Application Security Project, lists for continuous integration and continuous delivery (CI/CD), and turns them into 20 checks you can run this week. If you would rather have the pipeline reviewed and hardened for you, our devops consulting services cover CI/CD pipelines, least-privilege access and secrets management.

What is CI CD pipeline security?

CI CD pipeline security is the set of controls that stop someone from using your build and deploy system to steal credentials or ship code nobody reviewed. It covers the source repository, the build jobs, the artifacts they produce and the logs that record what happened.

The pipeline deserves its own attention because of what it holds. It can read your code, it stores deploy credentials, and it has a direct route to production. OWASP's CI/CD Security Cheat Sheet puts it plainly: CI/CD brings many benefits, and "it also increases an organization's attack surface."

This is a different job from scanning your application for vulnerabilities inside the pipeline. Scanners in the pipeline protect the product. Pipeline security protects the machinery that ships it. Our guide to DevOps vs DevSecOps covers the scanners; this one covers the machinery.

The OWASP Top 10 CI/CD Security Risks, with controls

The OWASP Top 10 CI/CD Security Risks name the ten ways pipelines are most often abused, numbered CICD-SEC-1 to CICD-SEC-10. Each risk has a recognizable shape in GitHub Actions or GitLab CI/CD, and each has a control that stops it. The table puts the three side by side.

The OWASP Top 10 CI/CD Security Risks, what each looks like in a pipeline and the control that stops it
RiskWhat it looks likeControl
1. Insufficient flow controlOne person can push to the main branch and trigger a production deploy aloneProtected branches, required review, no self-approval
2. Inadequate identity and access managementOld accounts, shared logins and tokens nobody ownsAn identity inventory, least privilege, stale accounts removed
3. Dependency chain abuseA build pulls the latest version of a package straight from a public registryLock files, pinned versions, checksum verification
4. Poisoned pipeline executionA pull request edits the pipeline file and the pipeline runs it with secretsReview of pipeline files, no secrets for unreviewed code
5. Insufficient pipeline-based access controlsEvery job can reach every secret and every environmentSecrets scoped per job and environment, clean runners
6. Insufficient credential hygieneLong-lived cloud keys stored as CI variables, secrets printed in logsShort-lived credentials, rotation, masking, secret scanning
7. Insecure system configurationA self-hosted runner or CI server left unpatched or on default settingsPatching, a named owner, a periodic settings review
8. Ungoverned usage of third-party servicesMarketplace actions and apps installed with broad access and never reviewedAn approved list, least privilege, removal when unused
9. Improper artifact integrity validationDeploy takes whatever sits in the registry under the expected tagSigned provenance, verified before deploy
10. Insufficient logging and visibilityNo record of who changed a pipeline file or used a tokenAudit logs on, sent to one place, alerts on changes

Read the table by row, not by tool. Seven of the ten controls are settings on platforms you already use. The other three (an identity inventory, an approved list of integrations and a settings review) are habits, and they cost a calendar reminder.

Securing a CI/CD pipeline: five controls first

Five controls cover most of the ten risks, and a small team can put them in without buying anything. They are numbered for reference, not in order of work; the order comes later, under the best practices.

1. Short-lived, least-privilege credentials

Securing CI CD pipeline credentials matters most, because stolen credentials are what turn a pipeline problem into a production problem. Give every pipeline identity the smallest permission that lets it do its job, and make the credential expire.

On GitHub Actions, that means two settings. GitHub's secure use reference calls it good practice to set the default permission of the built-in GITHUB_TOKEN to read access for repository contents, then raise it per job where needed. For cloud access, OpenID Connect (OIDC) lets a workflow request a short-lived access token that is valid for a single job and then expires, so no cloud key sits in the repository's secrets. GitLab offers the same pattern through ID tokens, which a job declares with the id_tokens keyword.

2. Pinned and verified third-party code

Pin everything the pipeline fetches to an exact, unchangeable version. A version tag such as v4 can be moved to different code by whoever controls the repository. A commit hash cannot.

GitHub's reference advises pinning actions to a full-length commit SHA, and it explains the stakes: a compromised action has access to all secrets configured on the repository. GitLab's pipeline security documentation gives the matching advice for its platform: pin included configuration to a specific commit, use SHA digests for Docker images, and install from lock files (npm ci, not npm install).

One trade-off is worth knowing. GitHub's documentation says Dependabot does not create alerts for actions pinned to SHA values, although its version updates can still open pull requests that move a pin forward. Turn those updates on, so pinned actions do not go stale. The same thinking applies to application packages, which our update on the npm supply chain attack wave of 2026 covers.

3. Protected branches and required review

No single person, and no single stolen account, should be able to change what ships. Protect the branches that deploy, and require a pull request with an approving review before anything merges into them.

Two details make this real. First, GitHub notes that by default branch protection rules do not apply to people with admin permissions, so switch on the setting that stops bypassing. Second, treat pipeline files as production code. GitHub suggests adding the workflow directory to CODEOWNERS, so a change to a workflow file needs approval from a designated reviewer. On GitLab, protected branches control who may merge and push, and they can require Code Owner approval.

4. Secrets out of code and logs

A secret should live in one managed place, reach only the job that needs it, and never appear in a file or a log line. GitHub's reference states the risk directly: any user with write access to a repository has read access to all secrets configured in it.

GitLab's documentation ranks the options. CI/CD variables are convenient but less secure than a secrets manager, so sensitive values belong in a manager; where a variable must hold one, mask it, hide it and protect it. On either platform, scan repositories for committed secrets and scope each secret to the environment that uses it.

5. Signed artifacts, verified before deploy

The last control answers one question at deploy time: was this artifact built by our pipeline, from our source? Signed provenance, a signed record of where and how an artifact was built, lets the deploy step check that before it runs anything.

GitHub's artifact attestations produce this record inside a workflow. Provenance has a limit, though. It proves where an artifact was built, not that the source was safe, so it works with review and pinning and does not replace them.

Where each control sits: source, build, release

Each control belongs to one stage of the pipeline, and each stage needs at least one gate. If a stage has none, an attacker who reaches it meets no resistance until production.

  • Source: protected branches and required review decide what code and which pipeline files may enter.
  • Build: pinned actions, short-lived credentials and a read-only token decide what the job may fetch and what it may touch.
  • Release: signed provenance, and a deploy step set to verify before deploy, decide what may reach production.

Two things are worth removing as you add those gates. Take out of the pipeline any long-lived keys stored as variables, and any moving tags on third-party actions and images. Both are trust you extended once and never checked again.

Two incidents that show the pattern

Two well-documented incidents show the same pattern: the attacker changed a third-party tool that pipelines trusted, and the tool read the secrets of every job that ran it. Both are described here from the primary disclosures.

Two CI/CD supply chain incidents, the OWASP risk behind each and the control that limits it
IncidentWhat was trustedLimiting control
Codecov Bash Uploader, 2021A script downloaded and run on every buildChecksum verification, short-lived credentials
tj-actions/changed-files, 2025An action referenced by a version tagPinning to a commit SHA, a read-only token

Codecov, 2021. In its security notice of April 15, 2021, Codecov reported that someone had altered its Bash Uploader script, starting on January 31, 2021. The altered script could export information stored in customers' CI environments, including credentials, tokens and keys. The actor got in through an error in Codecov's Docker image creation process that exposed a credential. Codecov learned of it on April 1, 2021, from a customer who compared the script's checksum with the published one. That is OWASP risk 9 on the customer side, and the check that caught it is the control in the table.

tj-actions/changed-files, 2025. The GitHub Advisory Database entry for CVE-2025-30066 records that attackers retroactively modified multiple version tags of this GitHub Action to reference a malicious commit, between March 14 and March 15, 2025. The code printed CI/CD secrets into workflow logs, and versions up to 45.0.7 were affected. The alert from CISA, the US Cybersecurity and Infrastructure Security Agency, says the issue was patched in v46.0.1 and tells affected teams to rotate their secrets. A workflow pinned to a commit SHA would not have followed the moved tags. That is risks 3 and 8 together.

SLSA build levels: how far to go

SLSA (Supply-chain Levels for Software Artifacts) is a specification that grades how much you can trust the way an artifact was built. For most small teams, Build Level 2 is a sensible first target, because a hosted build platform does most of the work.

The current version is SLSA 1.2, as of November 2026. It keeps the Build track and adds a Source track for the source code process. The Build track has four levels.

The four SLSA Build levels, what each requires and what each protects against
LevelRequiresFocus
Build L0NothingNo guarantees
Build L1Provenance showing how the package was builtMistakes, documentation
Build L2Signed provenance, generated by a hosted build platformTampering after the build
Build L3A hardened build platformTampering during the build

GitHub's documentation says its artifact attestations provide SLSA v1.0 Build Level 2 on their own, and that building inside a shared reusable workflow takes a team further. Level 3 asks more of the build platform than of you, so it can wait until a customer or an auditor asks for it.

For a longer treatment written for cloud-native teams, NIST, the US National Institute of Standards and Technology, published SP 800-204D, Strategies for the Integration of Software Supply Chain Security in DevSecOps CI/CD Pipelines, in February 2024.

A CI CD pipeline security checklist: 20 checks

These 20 checks turn the controls into yes-or-no questions, grouped by stage: five for source, six for build, four for release and five for visibility. A "no" is a task, not a verdict. Work through them with the person who set up the pipeline.

Source: five checks

  1. Is every branch that deploys protected against direct pushes?
  2. Does a merge need at least one approving review from someone other than the author?
  3. Do the protection rules apply to administrators too?
  4. Do changes to pipeline files need approval from a named owner?
  5. Has every account with write access been used recently, and does each belong to a current team member?

Build: six checks

  1. Is the default token for jobs read-only, with extra permissions granted per job?
  2. Does cloud access use short-lived credentials through OIDC or ID tokens, with no stored cloud keys?
  3. Is every third-party action, included template and base image pinned to a commit SHA or a digest?
  4. Do builds install dependencies from a lock file?
  5. Do jobs that run code from forks or unreviewed pull requests run without secrets?
  6. Are self-hosted runners, if you use any, patched and wiped between jobs?

Release: four checks

  1. Are production secrets scoped to the production environment only?
  2. Does a production deploy need an approval, or a merge to a protected branch?
  3. Does the build produce signed provenance for each artifact?
  4. Does the deploy step verify that provenance before it runs?

Visibility: five checks

  1. Are audit logs switched on for the source platform and the CI system?
  2. Do the logs go to one place that the pipeline itself cannot edit?
  3. Does someone get an alert when a pipeline file, a protection rule or a secret changes?
  4. Is there a current list of every app, action and integration with access, each with an owner?
  5. Do you know how to rotate every pipeline secret, and have you done it at least once?

CI CD pipeline security best practices, in order

CI CD pipeline security best practices are easiest to adopt in three passes: settings first, then pinning and secrets, then signing and logging. The order follows effort, not importance, so every pass leaves the pipeline safer than before.

  • First, the settings. Branch protection, required review, a read-only default token and the rule that binds administrators are switches. Flip them, then fix whatever breaks.
  • Next, pinning and secrets. Pin actions, templates and images, turn on automated update pull requests, replace stored cloud keys with OIDC, and move the remaining secrets into environment scopes. This pass touches every pipeline file, so do it one repository at a time.
  • Later, signing and logging. Generate provenance, verify it at deploy, and send audit logs to one place with alerts on changes.

Two things can wait for most small teams: SLSA Build Level 3, and network isolation for runners. If you use GitHub-hosted runners, each job runs in an ephemeral, clean virtual machine, which removes much of the runner hardening work. Self-hosted runners change that. GitHub's reference warns that they have no guarantee of a clean machine for each job and should almost never be used for public repositories.

Pipeline work also supports other reviews. A buyer's security questionnaire or a SOC 2 for startups readiness project will ask who can deploy and how changes are approved, and the checklist above is most of that answer. A pipeline review also pairs well with penetration testing for startups, which tests the running application, not the route your code takes to reach it.

How we review and harden a CI/CD pipeline

We start by reading what you have: the pipeline files, the branch rules, the identities and the secrets. You get a ranked list of gaps against the OWASP risks, in plain language, with the fix for each.

Then we close the gaps with your team, so the knowledge stays with you: short-lived credentials, pinned dependencies, review rules and a release path with a one-step rollback. That work is part of our DevOps consulting services for startups. Where the review points at the application as well as the pipeline, our code audit services cover the codebase.

Every engagement is under an NDA, and the IP is always yours. It starts with a 20-minute call, and we quote after it.

Frequently asked questions

What is CI CD pipeline security?

CI CD pipeline security is the practice of protecting the system that builds, tests and deploys software. It covers who can change code and pipeline files, what credentials jobs can use, which third-party code runs during a build, and whether the artifact that reaches production is the one your pipeline built.

What are CI CD pipeline security best practices?

The core practices are short-lived, least-privilege credentials for pipeline identities, third-party actions and dependencies pinned to exact versions, protected branches with required review, secrets held in a manager and masked in logs, and signed artifacts verified before deploy. Audit logs with alerts on changes complete the list.

How do you build a secure CI CD pipeline?

Build a secure CI CD pipeline in three passes. First switch on branch protection, required review and a read-only default token. Next pin third-party code and replace stored cloud keys with short-lived credentials. Then add signed provenance, verify it at deploy, and send audit logs to one place.

Where does security in CI CD pipeline design start?

It starts at the source repository. If one account can push to the deploy branch or edit a pipeline file without review, every later control can be switched off by the same account. Protect the branch, require review, and require approval for pipeline file changes before anything else.

Does a small team need SLSA?

A small team does not need to adopt the whole specification. SLSA Build Level 2, signed provenance generated by a hosted build platform, is a reasonable target, because platform features can produce it. Level 3 depends on a hardened build platform and can wait until a customer or an auditor asks for it.

Are hosted runners safer than self-hosted runners?

Hosted runners are usually the safer default for a small team. GitHub's documentation says its hosted runners execute code in ephemeral, clean virtual machines, while self-hosted runners have no such guarantee and should almost never be used for public repositories. If you run your own, patch them and wipe them between jobs.

Sources and update history

  1. OWASP Top 10 CI/CD Security Risks (project page and the ten risk pages)owasp.orgCHECKED 28 NOV 2026
  2. OWASP Cheat Sheet Series, CI/CD Security Cheat Sheetcheatsheetseries.owasp.orgCHECKED 28 NOV 2026
  3. OWASP Foundation, Aboutowasp.orgCHECKED 28 NOV 2026
  4. GitHub Docs, Secure use reference (GitHub Actions)docs.github.comCHECKED 28 NOV 2026
  5. GitHub Docs, OpenID Connectdocs.github.comCHECKED 28 NOV 2026
  6. GitHub Docs, About protected branchesdocs.github.comCHECKED 28 NOV 2026
  7. GitHub Docs, Artifact attestationsdocs.github.comCHECKED 28 NOV 2026
  8. GitLab Docs, Pipeline securitydocs.gitlab.comCHECKED 28 NOV 2026
  9. GitLab Docs, OpenID Connect (OIDC) authentication using ID tokensdocs.gitlab.comCHECKED 28 NOV 2026
  10. GitLab Docs, Protected branchesdocs.gitlab.comCHECKED 28 NOV 2026
  11. Codecov, Bash Uploader Security Update (April 15, 2021)about.codecov.ioCHECKED 28 NOV 2026
  12. GitHub Advisory Database, GHSA-mrrh-fwg8-r2c3 (CVE-2025-30066)github.comCHECKED 28 NOV 2026
  13. CISA, Supply Chain Compromise of Third-Party tj-actions/changed-files (CVE-2025-30066) and reviewdog/action-setup@v1 (CVE-2025-30154)cisa.govCHECKED 28 NOV 2026
  14. SLSA specification, version 1.2, Build: Track Basicsslsa.devCHECKED 28 NOV 2026
  15. NIST SP 800-204D, Strategies for the Integration of Software Supply Chain Security in DevSecOps CI/CD Pipelinescsrc.nist.govCHECKED 28 NOV 2026
Update history
  1. First published.