CI/CD Security

Back to glossary

What Is CI/CD Security?

CI/CD security is the practice of protecting continuous integration and continuous delivery pipelines from threats that can compromise the software build, test, and deployment process. CI/CD pipelines automate how code moves from a developer’s commit to production, making them critical infrastructure. A compromised pipeline can inject malicious code into every artifact it produces, affecting every downstream environment and customer.

As organizations ship faster and rely on automation to scale, CI/CD pipeline security has become a primary concern for security and platform engineering teams. Attackers increasingly target pipelines because a single point of compromise can cascade across an entire software portfolio.

Common CI/CD Security Risks

CI/CD pipelines connect source code repositories, build systems, artifact registries, testing frameworks, and deployment targets. Each connection point introduces potential attack surface. The most common risks include:

  • Poisoned pipeline execution: Attackers modify pipeline configuration files (like Jenkinsfiles, GitHub Actions workflows, or GitLab CI configs) to inject malicious steps into the build process. If pipeline definitions live in the same repository as application code, any contributor with write access can alter the build.
  • Secret exposure: Pipelines require credentials to access registries, cloud providers, databases, and third-party services. Hardcoded secrets, overly broad environment variables, and misconfigured secret stores can leak credentials through logs, artifacts, or error messages.
  • Dependency compromise: Build steps that pull dependencies from public registries are vulnerable to dependency confusion, typosquatting, and compromised upstream packages. Without verification, a malicious package can execute arbitrary code during the build.
  • Insufficient access controls: Overly permissive roles on CI/CD platforms allow unauthorized users to trigger builds, modify pipeline configurations, or access production deployment credentials. Lateral movement from a low-privilege CI job to a production deployment target is a common attack path.
  • Artifact tampering: Unsigned or unverified build artifacts can be modified between the build and deployment stages. Without integrity checks, teams cannot confirm that what was built is what gets deployed.
  • Self-hosted runner risks: Organizations using self-hosted build agents face additional risks from shared execution environments, persistent state between jobs, and insufficient isolation between pipeline runs.

Understanding these risks is the first step toward building pipelines that are resilient to both external attackers and insider threats.

CI/CD Security Controls Across the Pipeline

Effective CI/CD security applies controls at every stage of the pipeline. The table below maps key controls to the pipeline phase where they have the most impact:

Pipeline PhaseSecurity Controls
SourceBranch protection rules, signed commits, code review requirements, access controls on pipeline config files
BuildPinned and verified dependencies, isolated build environments, CI/CD vulnerability scanning for code and containers, minimal build agent permissions
TestSAST, SCA, and secret scanning integrated as pipeline gates, fail-fast policies on critical findings
ArtifactArtifact signing, provenance metadata (e.g., SLSA attestations), immutable artifact storage
DeployEnvironment-specific approval gates, infrastructure-as-code scanning, runtime policy enforcement, software deployment security controls
Post-deployDrift detection, runtime monitoring, audit logging of deployment events

Beyond stage-specific controls, several cross-cutting practices strengthen the entire pipeline, including:

  • Secret management: Use a dedicated secrets manager (HashiCorp Vault, AWS Secrets Manager, or similar) with short-lived credentials and automatic rotation. Never store secrets in pipeline config files or repository variables without encryption.
  • Pipeline-as-code governance: Treat pipeline definitions as security-critical code. Require code review for changes to CI/CD configuration files and restrict who can modify them.
  • Least-privilege access: Scope every pipeline step to the minimum permissions required. Use separate service accounts for build, test, and deploy stages. Avoid shared credentials across environments.
  • Audit and observability: Log every pipeline execution, including who triggered it, what changed, and what was deployed. Feed pipeline logs into your SIEM for correlation with other security events.

Organizations looking to deepen their pipeline protections should consider CI/CD pipeline security best practices that cover both preventive and detective controls. Mature teams also integrate build pipeline security assessments into their regular security review cadence to catch configuration drift and new risks as pipelines evolve.

FAQs

How is CI/CD security different from traditional application security testing?

Traditional AST focuses on vulnerabilities in application code. CI/CD security protects the infrastructure and automation that builds, tests, and deploys that code, covering pipeline configs, secrets, and access controls.

What are the most common attack paths against CI/CD pipelines today?

Poisoned pipeline execution, compromised dependencies, stolen secrets, and abuse of overly permissive service accounts are the most frequent attack paths targeting CI/CD environments.

Which security checks should be automated at each stage of a CI/CD pipeline?

Source stage: secret scanning and commit signing. Build stage: dependency verification and container scanning. Test stage: SAST and SCA. Deploy stage: artifact signature verification and policy checks.

How can teams securely manage secrets and credentials used in CI/CD workflows?

Use a centralized secrets manager with short-lived, auto-rotating credentials. Avoid hardcoding secrets in pipeline files. Scope access per pipeline stage and audit all secret retrievals.

What metrics or KPIs can DevSecOps teams track to measure CI/CD security maturity?

Track pipeline policy compliance rate, mean time to remediate pipeline vulnerabilities, percentage of signed artifacts, secret rotation frequency, and audit coverage across pipeline stages.

Back to glossary
See Apiiro in action
Meet with our team of application security experts and learn how Apiiro is transforming the way modern applications and software supply chains are secured. Supporting the world’s brightest application security and development teams: