Safeguard
Supply Chain•

Do CI build and tool images need the same scanning as production images?

Build images never reach customers but hold your tokens and keys. Scan them for different reasons and with different rules than production images.

Safeguard Security Team
4 min read

Yes, but with different rules. Build and tool images do not serve traffic, so a library flaw there rarely matters for the same reasons. They do run your pipeline with access to tokens, signing keys and source code, so the question changes from "can customers be attacked" to "can the build be taken over". Scan them, and focus on trust and provenance.

Two kinds of images, two threat models

A production image is exposed to inputs from users. A build image is exposed to inputs from your dependencies, pull requests and third party actions or plugins. When a build step runs untrusted code inside a build image, an attacker who controls that code can reach whatever the job can reach.

That is why the image used to run CI jobs counts as part of your supply chain. If someone replaces a tool image with a tampered one, everything built with it is suspect.

Where builder images show up

ImageWhere it appearsShips to production
Compiler stage in a multi-stage buildDockerfileNo
CI job image or runner imagePipeline configNo
Tool images for linters, scanners, deploy toolsPipeline stepsNo
Test database and service imagesPipeline servicesNo

The multi-stage build documentation explains that the build tools of earlier stages are left behind and not saved in the final image. Good: they cannot add findings to your production SBOM. The SBOM attestation documentation adds that by default BuildKit scans only the final stage, so the SBOM reflects what ships.

That also means builder stages are invisible to your normal image scan. If you want them covered, scan them deliberately.

What to check on build images

  1. Source and pinning. Reference tool images by digest, from a registry you control or trust. See pinning GitLab CI images and tool installs.
  2. Provenance. Prefer images with known origin. See questions to ask before running a vendor container image.
  3. Contents. Remove tools the job does not need, since every extra tool is something an attacker can use.
  4. Credentials. Check which secrets and tokens the job exposes to the image and scope them narrowly.
  5. Findings. Scan for known flaws, but triage by what the job can reach, not by severity alone.

What severity means here

A critical flaw in an image library that cannot be reached from a build step is low priority. A moderate flaw in the runner agent itself, or in a tool that handles untrusted input like pull request content, is more serious. Weigh findings by exposure to untrusted input and by what privileges the job has.

Keep it proportionate

Do not demand the same SLA as production. Use a looser clock for build images and a stricter rule for provenance and pinning. A monthly refresh is a fair default, and sooner when a tool in the image has an exploited flaw.

Practical steps

Where Safeguard fits

Safeguard scans dependencies and container images and applies gates in pipelines, which can include the images your CI uses. Run a free scan on a tool image to see the output.

Quick check

Do builder stages appear in the production SBOM?

Not by default. BuildKit scans the final stage, so earlier stages need their own scan if you want coverage.

What is the first thing to fix for CI images?

Pin them by digest from a registry you trust. That blocks silent replacement, which is the main risk.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.