DevSecOps · November 4, 2026 · 6 min read
Five weak spots we look for in a CI/CD pipeline
Your pipeline can change production, so it deserves the same care as production. These are the five weaknesses we check first, and how to fix each one.
A CI/CD pipeline usually holds the keys to production: cloud credentials, registry access and the power to deploy. That makes it one of the most valuable targets in your environment, yet it is often configured once and never reviewed. These are the five areas we look at first.
1. Long-lived secrets in pipeline variables
Static cloud keys stored as CI variables tend to live for years, get copied between projects and leak through logs. Where your CI platform and cloud provider support it, replace them with OpenID Connect (OIDC) federation, so each job receives short-lived credentials scoped to that repository and branch. Where static secrets remain, keep them in a secrets manager, mask them in logs and rotate them on a schedule.
2. Shared or long-running runners
If one build machine runs jobs for every project and keeps state between them, a single compromised job can read another project's secrets or tamper with its builds. Prefer ephemeral runners that start clean for each job, separate runners for sensitive projects, and no deploy credentials on runners that build untrusted code such as pull requests from forks.
3. Unpinned dependencies and actions
A tag like v4 or latest can be moved to point at different code. Pin third-party actions and base images to an exact commit or digest, and pin package versions with a lockfile. Update them deliberately, through a reviewed change.
# Illustrative GitHub Actions example
permissions:
contents: read # least privilege by default
id-token: write # only if this job uses OIDC
steps:
# Pin to a full commit SHA, with the version as a comment
- uses: actions/checkout@<full-commit-sha> # v44. Rebuilding for each environment
If staging and production each build their own artifact, what you tested is not exactly what you ship. Build once, scan the result, produce an SBOM, sign it, and promote that same immutable digest from environment to environment. Deployment then checks the signature before anything runs.
# Illustrative: sign and later verify an image by digest with cosign
cosign sign registry.example.com/app@sha256:<digest>
cosign verify registry.example.com/app@sha256:<digest> \
--certificate-identity <expected-identity> \
--certificate-oidc-issuer <expected-issuer>5. Over-permissive tokens and unprotected branches
Pipeline tokens often get far more permission than the job needs, and the main branch can sometimes be changed without review. Set default token permissions to read-only and grant more per job. Protect the main branch, require reviews for changes, and treat changes to pipeline definitions with the same care as application code, because they can change what reaches production.
Where to start
Pick the pipeline that deploys to production and check these five points against it. Most fixes are configuration changes rather than new tools. If you want a second pair of eyes, our CI/CD Security Review covers these and more, and ends with a reference pipeline you can adopt.
Written by Opsentriq engineering. Commands are illustrative; adapt them to your environment.