Securing CI/CD

CI/CD Pipeline Security: Where to Start and What to Verify

Secure your CI/CD pipeline by mapping trust boundaries, protecting deployment jobs, isolating runners and reviewing credentials, dependencies and release evidence.

A CI/CD pipeline can turn source changes into live production access. Its security therefore depends on more than the scanners it runs. Review who can change the workflow, what code executes during a build and which identities can approve and deploy the result.

Start with one representative application and follow a change from a contributor's branch to the live service. Record every place where permissions, artefacts or trust change.

Map the release path

List the source repository, branch rules, pipeline definitions, runners, package registries, artefact storage and deployment destination. Identify external actions, plugins and services that receive code or credentials.

For each stage, ask whose instructions are being executed. A dependency installation script, pull request title or generated build file can be attacker-controlled even if the surrounding workflow is trusted.

Protect the configuration that grants access

Require suitable review for pipeline changes as well as application code. Restrict changes to protected branches and deployment environments. Check who can bypass those rules, modify required checks or approve their own production release.

Separate build and deployment permissions. A job that tests an untrusted change should not receive production credentials merely because another stage in the same project needs them.

Establish a permissions baseline

In GitHub Actions, a deliberately restricted default is a useful starting point:

permissions:
  contents: read

Grant additional permissions to the specific job that needs them. On other platforms, apply the equivalent job-token and project permission controls. Read-only repository access does not make a job safe if it can still reach a privileged runner, secret store or cloud metadata endpoint.

Isolate execution environments

Use isolated, disposable runners for untrusted work where possible. Review network access, host mounts, privileged containers and persistence between jobs. A self-hosted runner connected to an internal network can provide an attack path beyond the repository.

Keep runner software and build images maintained. Ensure that caches, workspaces and artefacts cannot carry executable changes from an untrusted job into a privileged one without validation.

Control dependencies and release artefacts

Pin third-party actions to reviewed immutable references where supported. Use appropriate dependency lockfiles, trusted registries and integrity checks. Review changes to the lockfile and build configuration alongside source changes.

Build once and promote the identified artefact where the deployment model permits it. Record the source commit and resulting artefact digest so reviewers can establish what was tested and what reached production.

Test the boundaries with safe scenarios

ScenarioExpected boundary
External contributor opens a pull requestNo production credentials or privileged deployment.
Workflow definition changesRequired review still applies.
Unapproved branch requests cloud accessThe cloud trust policy refuses it.
A security check fails unexpectedlyThe workflow handles the failure explicitly.
Deployment is cancelled or rolled backA known artefact and accountable decision remain visible.

Keep the review practical: confirm the controls in the platform rather than relying only on the YAML file. Assign owners to exceptions and revisit the path when runners, integrations or deployment methods change.

Further reading: OWASP CI/CD guidance and GitHub Actions secure use.

Read our testing methodology or discuss your assessment.

See your first test report this week.

Book a 30 minute demo. We will verify one of your targets with you and run a test against it, so you can judge the results on your own systems.

Book a demo