-
Notifications
You must be signed in to change notification settings - Fork 219
fix: exit early on invalid image architecture #1476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Architecture Validation Inconsistency
The early return path in GetPublicImage when using dockerhubRepository.GetImage() bypasses the new verifyImagePlatform check, allowing images with incorrect architectures to be returned. This inconsistency means images from the default registry without auth won't have their architecture validated, while all other images will.
packages/orchestrator/internal/template/build/core/oci/oci.go#L52-L60
infra/packages/orchestrator/internal/template/build/core/oci/oci.go
Lines 52 to 60 in 7f99e82
| if authProvider == nil && ref.Context().RegistryStr() == name.DefaultRegistry { | |
| img, err := dockerhubRepository.GetImage(ctx, tag, DefaultPlatform) | |
| if err != nil { | |
| return nil, fmt.Errorf("error getting image: %w", err) | |
| } | |
| telemetry.ReportEvent(ctx, "pulled public image") | |
| return img, nil |
7f99e82 to
0174926
Compare
💡 Codex Reviewinfra/packages/orchestrator/internal/template/build/core/oci/oci.go Lines 82 to 86 in 7f99e82
The newly added ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Note
Add platform verification for pulled images and standardize platform handling, updating telemetry and tests accordingly.
platform := DefaultPlatformand use it consistently inGetPublicImageandGetImage.verifyImagePlatform(img, platform)to validate image architecture after pull (both remote and artifact registry paths).verifyImagePlatform(img, platform)inpackages/orchestrator/internal/template/build/core/oci/oci.goto enforce architecture match.oci_test.go, set image configArchitectureandOSto match expected platform before testing.Written by Cursor Bugbot for commit 66c32bb. This will update automatically on new commits. Configure here.