CI/CD pipelines are critical for modern software development, but they come with serious risks. These automated workflows streamline code deployment but can expose your organisation to potential threats if not secured properly. Here’s a quick breakdown of the main risks and how to address them:
- Access Control Issues: Misconfigured permissions can lead to privilege escalation. Stick to the principle of least privilege and automate IAM reviews.
- Secrets and Credential Leaks: Hardcoded keys and exposed tokens are common vulnerabilities. Use tools like TruffleHog and switch to short-lived tokens (e.g., OIDC).
- Vulnerable Dependencies: Third-party libraries can introduce risks. Dependency scanners like Snyk and SBOM generation help identify and manage these vulnerabilities.
- Pipeline Misconfigurations: Poorly set up CI/CD tools can lead to data leaks or code injection. Regular audits and tools like Checkov can mitigate this.
- Artefact Tampering: Unsigned build artefacts may be altered. Use signing tools like Cosign to ensure integrity.
Automating detection and security checks is key. Integrate tools like SAST, SCA, and secret scanners directly into your pipeline to catch issues early. By prioritising security at every stage, you can protect your software supply chain from potential breaches.
::: @figure
{CI/CD Pipeline Risks & Detection Strategies at a Glance}
:::
Top Risks in CI/CD Pipelines
Insufficient Access Controls
Misconfigured access controls are a major weak spot in CI/CD environments. When role-based access control (RBAC) policies aren't set up correctly, developers or automated services might end up with permissions far beyond what they actually need. This opens the door to privilege escalation, where an attacker (or even a misconfigured service account) could gain elevated access, deploy unauthorised changes, or manipulate build configurations.
Even something as small as a service account with overly broad, cluster-wide permissions can become a serious issue if exploited. The best defence? Stick to the principle of least privilege - ensure every role has only the access it absolutely requires.
Secrets and Credential Leaks
API keys, passwords, and tokens often end up hardcoded into source code, configuration files, build logs, or even container layers. This creates a significant risk of exposure, especially when these credentials are scattered across different tools and environments. It becomes difficult to track where they are, whether they're still active, or who might have access to them.
These vulnerabilities often stem from poor configuration practices. However, they are further complicated by risks tied to dependencies, which bring their own challenges.
Vulnerable Dependencies in Builds
Modern applications heavily rely on third-party libraries, but this reliance comes with its own set of risks. A glaring example is the Log4j exploit (Log4Shell, CVE-2021-44228) disclosed in December 2021. This critical flaw in a widely-used Java logging library exposed how easily overlooked dependency vulnerabilities can wreak havoc. At the time, the UK's National Cyber Security Centre (NCSC) urged organisations to immediately review their software supply chains.
The problem is compounded by transitive dependencies - libraries that your dependencies rely on - which can introduce unpatched vulnerabilities into your builds.
Pipeline Misconfigurations
CI/CD tools themselves can become a liability if not set up securely. Exposed Jenkins instances, overly permissive Docker registries, or YAML configurations that allow code injection are just a few examples of how misconfigurations can lead to remote code execution or data leaks. Regularly auditing these configurations is critical to minimise such risks.
Artefact Integrity and Tampering
Unsigned build artefacts, such as container images or binaries, are at risk of being tampered with if intercepted during the pipeline. Without proper signing and verification processes in place, compromised packages could make their way into production, jeopardising the entire software supply chain. Spotting and addressing these risks early is crucial for maintaining a secure pipeline.
Need help optimizing your cloud costs?
Get expert advice on how to reduce your cloud expenses without sacrificing performance.
CI/CD: Top 10 Security Risks
How to Detect and Mitigate CI/CD Risks
Automating detection and mitigation steps can save time and reduce human error. Many risks within CI/CD pipelines can be addressed through tools and processes that work seamlessly in the background, eliminating the need for manual audits.
Automated IAM Monitoring
Automated monitoring of Identity and Access Management (IAM) permissions helps flag issues like overly broad access (e.g., permissions: write-all in GitHub Actions). Tools such as Open Policy Agent (OPA) allow you to enforce security rules in a machine-readable format. These tools can automatically block deployments that don't meet your security standards.
Switch from static, long-lived credentials to OpenID Connect (OIDC). OIDC replaces stored API keys with short-lived tokens, scoped to specific repositories or branches, and expiring after each pipeline run. This simple change removes a major source of credential-related vulnerabilities.
| IAM Strategy | Mechanism | Security Benefit |
|---|---|---|
| Static Credentials | Long-lived API keys/passwords | High risk; valid until manually rotated |
| OIDC / Federation | Short-lived tokens (minutes/hours) | Removes stored secrets; scoped to specific tasks |
| JIT Access | Temporary elevation on-demand | Reduces standing privileges; provides audit trails |
| RBAC / ABAC | Role or attribute-based roles | Aligns access with job functions |
Always set permissions at the job level rather than the workflow level to minimise the scope of the GITHUB_TOKEN. Automate quarterly reviews to identify and revoke permissions for inactive users or service accounts.
To further secure pipelines, integrate secret scanning and runtime anomaly detection.
Secret Scanning and Runtime Detection
Secret scanning should be an ongoing process, not a one-time check. Use pre-commit hooks and post-commit CI checks to catch secrets before and after code enters the repository. Additionally, monitor repositories continuously to catch secrets that may have been exposed in older commits.
Tools like TruffleHog, GitGuardian, and Gitleaks are designed for this purpose. For runtime protection, Harden-Runner can monitor network activity and processes during pipeline execution, flagging suspicious behaviour.
The risks are real: in 2026 alone, 29 million secrets were detected on public GitHub [3]. Notable incidents include the GhostAction campaign in September 2025, where attackers compromised 327 GitHub users and harvested 3,325 secrets from 817 repositories [1]. Similarly, a supply chain attack in February 2026 on Aqua Security's Trivy repository exposed 33,000 secrets across roughly 7,000 machines [1].
A compromised pipeline is not just a build system issue. It is a direct path to production, to customer data, and to every secret your application depends on.- Lorikeet Security [2]
A simple but effective mitigation is setting persist-credentials: false in the actions/checkout configuration. This prevents GITHUB_TOKEN from being stored in the .git directory, reducing the risk of leaks via build artefacts [1].
Dependency Scanning and SBOM Generation
Tools like Snyk and Dependabot are invaluable for identifying vulnerable dependencies. These tools integrate directly with GitHub and can automatically create pull requests when a patched version of a vulnerable library is available, reducing the manual effort needed to track CVEs.
In addition to scanning, generating a Software Bill of Materials (SBOM) provides an auditable list of every library and component in your build. This is increasingly important for regulatory compliance and helps you quickly assess exposure to new vulnerabilities, such as Log4Shell.
Pipeline Configuration Audits
Your pipeline configurations - whether they're Terraform files, Kubernetes manifests, or GitHub Actions YAML - carry risks just like application code. Tools like Checkov, tfsec, and KICS can scan these files for insecure settings, such as misconfigured S3 buckets or overly permissive IAM roles, before they reach production.
For stricter policy enforcement, Terraform Sentinel and Open Policy Agent can block non-compliant changes entirely. Configure these tools to fail builds automatically when critical vulnerabilities are detected. CIS Benchmarks provide a standardised baseline for evaluating configurations.
Another best practice is to pin third-party actions to immutable commit SHAs rather than mutable tags like @v1 or @main. Mutable tags can be silently updated by compromised repositories, whereas SHAs offer a fixed reference [4].
Artefact Signing and Image Scanning
Unsigned artefacts pose a risk of tampering. Without verification, you can't guarantee that a container image or binary hasn't been altered since it was built. Tools like Cosign (part of the Sigstore project) allow you to cryptographically sign container images during your pipeline, with verification enforced at deployment.
For scanning, Trivy is a widely used tool that checks container images for vulnerabilities, misconfigurations, and exposed secrets. In Kubernetes environments, admission controllers can block the deployment of unscanned images or those running as root, ensuring these checks are enforced automatically rather than relying on manual review.
Building a Strong CI/CD Security Posture
Detection tools are only effective when they’re part of a continuous security strategy. Scanning for secrets or checking for misconfigurations in isolation won’t cut it. The aim should be to create a CI/CD pipeline that incorporates ongoing, automated security checks. This approach lays the groundwork for advanced practices like shift-left security.
Shift-Left Security in CI/CD
Shift-left security focuses on identifying and addressing issues early, significantly reducing the cost and effort required to fix them. This involves integrating tools like SAST at the commit stage, running SCA during builds, and using IaC scanning tools like Checkov to catch problems as soon as possible.
Two essential practices can strengthen this approach:
- Ephemeral runners: Use temporary, clean environments for every build. These environments are destroyed after each run, preventing secrets or malware from persisting.
- Security gates: Set hard thresholds that automatically fail a build if critical vulnerabilities are found, instead of just logging warnings.
Integrating security findings into developer workflows - such as pull request comments or Slack notifications - ensures issues are addressed quickly.
To further reduce risk, use dynamic secrets that expire after each run. This eliminates the dangers of long-lived credentials. Pairing this with OIDC removes the need for static keys, addressing a common security vulnerability.
For teams looking to refine these practices, external expertise can help streamline the process.
How Hokstad Consulting Can Help with CI/CD Optimisation

Hokstad Consulting specialises in building automated CI/CD pipelines that prioritise both security and cost efficiency from the outset. Their DevOps transformation service includes everything from setting up IAM policies and managing secrets to enforcing deployment gates and signing artefacts. Instead of retrofitting security onto existing systems, they design workflows where detection is built directly into the process.
For businesses already operating cloud infrastructure, Hokstad also provides ongoing security audits and performance reviews. These identify misconfigurations and access control weaknesses before they become exploitable. Their services are tailored to suit your specific setup, whether it’s GitHub Actions on AWS, a self-hosted GitLab runner, or a hybrid configuration.
Measuring CI/CD Security Performance
To evaluate the effectiveness of your CI/CD security, focus on these three metrics:
| Metric | What It Measures | Target Benchmark |
|---|---|---|
| Mean Time to Detect (MTTD) | Speed of identifying vulnerabilities or misconfigurations | Under 24 hours for critical issues |
| Mean Time to Repair (MTTR) | Time taken to fix confirmed issues | Under 72 hours for critical vulnerabilities |
| Policy Compliance Rate | Percentage of pipelines passing all OPA checks | 100% for production deployments |
Tracking MTTD and MTTR over time helps determine whether your tools are improving security or just creating noise. Meanwhile, a rising compliance rate - measured against standards like CIS Benchmarks or OWASP SAMM - provides a clear, auditable record of progress. This is increasingly valuable for meeting regulatory requirements and satisfying client expectations.
Conclusion and Key Takeaways
Key Risks and Detection Strategies Recap
In this article, we’ve explored five major risks to CI/CD pipelines: insufficient access controls, secrets and credential leaks, vulnerable dependencies, pipeline misconfigurations, and artefact tampering. Each of these risks has a corresponding detection strategy to mitigate potential threats: IAM monitoring, secret scanning, SCA with SBOM generation, configuration audits, and artefact signing using tools like Sigstore or Cosign.
Real-world breaches have shown how unmonitored pipelines and poorly configured workflows can open doors to attackers. This makes it critical to implement proper controls. These detection strategies highlight the importance of automating security checks to safeguard modern CI/CD pipelines effectively.
The Role of Automation in CI/CD Security
Keeping up with today’s fast-paced deployment cycles is impossible with manual security reviews alone. Automated scanning tools - whether it’s SAST at the commit stage, SCA during builds, or OPA policy checks before deployment - reduce the need for human intervention while ensuring thorough and consistent security checks.
Mika Ayenson, PhD, from Elastic Security Labs, summed it up well:
The attack surface isn't a server with a CVE, it's a YAML file.[1]
Automation ensures that every YAML file, dependency update, and workflow is scrutinised, providing a dependable safety net for your CI/CD processes.
Next Steps for Businesses
To strengthen your pipeline security, start by auditing your current practices. Evaluate your GITHUB_TOKEN default permissions, identify any long-lived secrets, and verify that third-party actions are pinned to specific commit SHAs instead of mutable tags. These straightforward steps can drastically reduce your risk.
Need help integrating these controls? Hokstad Consulting offers services to enhance your CI/CD pipeline security, from IAM policy design to artefact signing and deployment gates. They can help you build a secure and reliable foundation for your DevOps workflows.
FAQs
Which CI/CD security checks should we prioritise first?
Focusing on automated tools such as static application security testing (SAST), dependency scanning (SCA), secret management, and role-based access controls is key to maintaining a secure development pipeline. These tools are designed to spot vulnerabilities and misconfigurations at an early stage, helping to minimise potential risks and strengthen overall security. By integrating these checks into your workflow, you can address issues before they escalate, ensuring a more resilient application environment.
How do we move from long-lived secrets to OIDC without breaking deployments?
Transitioning from long-term secrets to OpenID Connect (OIDC) requires a focus on automation and security within your CI/CD pipelines. Start by implementing tools that can automatically scan for and detect secrets, helping to prevent leaks before deployment. Use secret management systems to centralise credential handling, automate secret rotation, and enforce strict policies to avoid hardcoding sensitive information.
For deployments, switch to short-lived, dynamically generated OIDC tokens. These tokens reduce the risks associated with static credentials. Finally, maintain continuous monitoring of your pipelines to quickly identify and resolve any issues that may arise during the migration process.
What should we block in the pipeline versus just warn about?
Block harmful or unauthorised code, sensitive information, and configuration changes within the pipeline to tackle urgent security risks effectively. For less pressing issues, such as potential vulnerabilities or settings that may not pose an immediate threat, provide warnings instead. This method ensures critical risks are addressed promptly while still managing other concerns without halting the pipeline's workflow.