Skip to content

policy: verify BuildKit builder images#3961

Merged
tonistiigi merged 1 commit into
docker:masterfrom
tonistiigi:buildkit-default-policy
Jul 22, 2026
Merged

policy: verify BuildKit builder images#3961
tonistiigi merged 1 commit into
docker:masterfrom
tonistiigi:buildkit-default-policy

Conversation

@tonistiigi

Copy link
Copy Markdown
Member

Extend the built-in policy to validate signed moby/buildkit release and floating tags before docker-container builders are created.

Pull the image first, inspect it through Docker, and bind verification to the descriptor digest. Resolve signature attestations through the BuildKit API embedded in the Docker daemon.

If pulling fails, use a local image while applying the same verification when the containerd image store exposes an immutable descriptor. Keep the classic image-store behavior unchanged because no descriptor is available.

Allow unmanaged repositories and digest-only references unchanged. Add the allow-untrusted-image driver option as an explicit verification bypass.

--

I think in the future this could be optimized to make policy eval command share more code with this. Currently some similar code is in cli package of that command that I didn't want to change yet.

Extend the built-in policy to validate signed moby/buildkit release and
floating tags before docker-container builders are created.

Pull the image first, inspect it through Docker, and bind verification to the
descriptor digest. Resolve signature attestations through the BuildKit API
embedded in the Docker daemon.

If pulling fails, use a local image while applying the same verification when
the containerd image store exposes an immutable descriptor. Keep the classic
image-store behavior unchanged because no descriptor is available.

Allow unmanaged repositories and digest-only references unchanged. Add the
allow-untrusted-image driver option as an explicit verification bypass.

Document the behavior and add policy, digest-pinning, and local fallback
coverage.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi
tonistiigi force-pushed the buildkit-default-policy branch from 3b5e22c to acaf251 Compare July 21, 2026 01:23
@tonistiigi
tonistiigi marked this pull request as ready for review July 21, 2026 15:49
@tonistiigi tonistiigi added this to the v0.36.0 milestone Jul 21, 2026
Comment thread driver/bkimage/bkimage.go
DefaultImage = "moby/buildkit:buildx-stable-1" // TODO: make this verified
QemuImage = "tonistiigi/binfmt:latest" // TODO: make this verified
DefaultImage = "moby/buildkit:buildx-stable-1"
QemuImage = "tonistiigi/binfmt:latest" // TODO: make this verified

@crazy-max crazy-max Jul 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a follow-up but looks tricky to verify QEMU image used by the kubernetes driver during deployment at:

podTemplate.Spec.InitContainers = []corev1.Container{
{
Name: "qemu",
Image: opt.Qemu.Image,
Args: []string{"--install", "all"},
SecurityContext: &corev1.SecurityContext{
Privileged: &privileged,
},
},
}

We would need to know beforehand the node platform to perform the verification.

cc @AkihiroSuda

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current policy verifier resolves signatures against a selected platform manifest, so Kubernetes cannot safely use the local default platform here. We'd need either a known pod platform or an all-platform verification story before verifying and pinning this init image.

Comment thread driver/bkimage/bkimage.go
// them. Images from other repositories pass through unverified; the
// allow-untrusted-image driver-opt is only needed when a TrustedRepo tag
// that the policy covers does not verify correctly.
TrustedRepo = "docker.io/moby/buildkit"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just promote buildkit (and binfmt, xx, ...) to DOI?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would that help?

@tonistiigi
tonistiigi merged commit 4096214 into docker:master Jul 22, 2026
162 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants