Only send the ECR pull secret for images that need it - #3148
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Every Fleet template carried `imagePullSecret: ecr-credentials`, including for
images pulled anonymously. That is not merely redundant: the gateway policy
reads the secret as "enforce the private-registry allowlist", so any public
image outside that allowlist was refused before a pull was ever attempted.
image_configuration_allowed { not has_pull_secret } # any image
image_configuration_allowed { template.imagePullSecret == ecr_pull_secret
allowed_image } # allowlist only
Send it only for the account private ECR, which is the one registry the secret
authenticates. Verified against the live gateway with identical requests
differing only in the image:
ghcr.io/... (not allowlisted) main: 403 "k8s request is not allowed"
fix: admitted
public.ecr.aws/... (allowlisted) main: admitted
fix: admitted
This unblocks booting a containerDisk from ghcr.io, quay.io or Docker Hub, so
a prebuilt workspace image can be published without ECR access.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
r33drichards
force-pushed
the
pull-secret
branch
from
August 13, 2026 17:45
78e1636 to
6003f5a
Compare
This was referenced Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every Fleet template carried
imagePullSecret: ecr-credentials, including for images that are pulled anonymously.That is not merely redundant. The gateway's admission policy reads the secret's presence as "enforce the private-registry allowlist":
image_configuration_allowed { input.method != "PATCH"; not has_pull_secret } image_configuration_allowed { input.method != "PATCH" template.imagePullSecret == ecr_pull_secret allowed_image }So attaching it unconditionally forced every template into the second branch, and any public image outside the allowlist was refused before a pull was ever attempted — with the generic
403 k8s request is not allowed, which gives no hint that the image was the problem.The fix
Send the secret only for the account's private ECR (
*.dkr.ecr.*.amazonaws.com), the one registry it actually authenticates. Public registries —public.ecr.aws,ghcr.io,quay.io, Docker Hub — take thenot has_pull_secretbranch, as they always should have.Verification
Against the live gateway, with requests identical but for the image:
mainghcr.io/trycua/minecraft-workspace:latest(not allowlisted)k8s request is not allowedpublic.ecr.aws/k5j5w0x5/cua-windows-2022(allowlisted)The allowlisted path is unchanged, so this loosens nothing that was previously enforced for private images — a private ECR ref still carries the secret and still faces the allowlist.
Admission runs before any pull, so the ghcr image did not need to exist for this to be conclusive.
Tests
tests/test_pull_secret.pycovers the predicate and, more importantly, the built template for a public image, a public non-ECR registry, and a private ECR ref. Confirmed they fail without the source change (stashing only the source, not the tests).Why now
This unblocks booting a containerDisk published to GHCR, which is what the upcoming Minecraft guide needs: readers pull a prebuilt workspace image instead of installing Minecraft inside a Fleet instance by hand. It also removes an ECR dependency for anyone publishing their own images.
Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com
🤖 Generated with Claude Code