Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Integrates ORAS Go v3’s full registry config stack into Helm’s registry client (policy evaluation, signature verification hooks, configurable config-path loading, and login Location rewrite), while completing remaining v2→v3 API updates.
Changes:
- Switch to ORAS v3 packages and update reference parsing (
properties.NewReference,.Tag). - Load and apply full container config stack via
remote/config, wiring policy evaluation and optional signature verification into repository construction. - Update CLI registry-client wiring to use the command’s
outwriter and adjust/extend registry tests for the new behavior.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/registry/transport.go | Update ORAS retry transport import to v3 path. |
| pkg/registry/reference.go | Move reference parsing to ORAS v3 properties reference type/API. |
| pkg/registry/reference_test.go | Adjust tests for v3 .Tag field. |
| pkg/registry/generic.go | Refactor GenericClient to delegate repository creation to Client.newRepository(). |
| pkg/registry/client.go | Core wiring: config stack loading, builder setup, policy/signature hooks, Location rewrite on login, v3 login/logout APIs. |
| pkg/registry/client_test.go | Update login tests and add tests for policy evaluator/config options/login behavior. |
| pkg/registry/client_http_test.go | Update ORAS content import path to v3. |
| pkg/cmd/*.go | Thread out io.Writer into registry client construction in various commands. |
| oras-go-v3-plan.md | Add migration plan documentation for ORAS v3 integration steps. |
| go.mod | Add ORAS v3 requirement and a local replace to ./oras-go. |
| go.sum | Remove ORAS v2 sums. |
Comments suppressed due to low confidence (1)
go.mod:185
- This committed local-path
replace github.com/oras-project/oras-go/v3 => ./oras-gomakes the build dependent on a bundled copy of oras-go rather than the module proxy, and can interfere with dependency auditing and reproducible builds. If this is only for local development, it should typically not be committed; otherwise consider vendoring intentionally (documented) or switching to an upstream version/pseudo-version withoutreplace.
replace github.com/oras-project/oras-go/v3 => ./oras-go
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Promptless prepared a documentation update related to this change. Triggered by PR #32065 Added documentation for the new container ecosystem configuration support, including credential discovery from Docker/Podman, configuration file loading ( |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 21 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (2)
pkg/registry/client_test.go:101
TestLogin_ResetsForceAttemptOAuth2_OnFailureno longer asserts anything aboutForceAttemptOAuth2. Rename this test (and its doc comment) to reflect the current behavior being validated (e.g., login fails when the registry is unreachable).
// Verifies that Login restores ForceAttemptOAuth2 to false even when ping fails.
func TestLogin_ResetsForceAttemptOAuth2_OnFailure(t *testing.T) {
t.Parallel()
pkg/registry/client.go:571
LoginOptTLSClientConfigpanics for common user error cases (missing/invalid cert/key/CA files, or CA parse failures). Because Helm CLI passes these options directly from flags, this would crash the command instead of returning an actionable error message. Please propagate these errors back throughLogin()(e.g., record an error in the operation and haveLoginreturn it) rather than panicking.
// LoginOptTLSClientConfig returns a function that sets the TLS settings on login.
func LoginOptTLSClientConfig(certFile, keyFile, caFile string) LoginOption {
return func(o *loginOperation) {
if (certFile == "" || keyFile == "") && caFile == "" {
return
}
// Set file path fields for the config-driven path.
if certFile != "" && keyFile != "" {
o.client.certFile = certFile
o.client.keyFile = keyFile
}
if caFile != "" {
o.client.caFile = caFile
}
// Also update the authorizer transport for the legacy path (customHTTPClient=true).
tlsConfig, err := ensureTLSConfig(o.client.authorizer, nil)
if err != nil {
panic(err)
}
if certFile != "" && keyFile != "" {
authCert, err := tls.LoadX509KeyPair(certFile, keyFile)
if err != nil {
panic(err)
}
tlsConfig.Certificates = []tls.Certificate{authCert}
}
if caFile != "" {
certPool := x509.NewCertPool()
ca, err := os.ReadFile(caFile)
if err != nil {
panic(err)
}
if !certPool.AppendCertsFromPEM(ca) {
panic(fmt.Errorf("unable to parse CA file: %q", caFile))
}
tlsConfig.RootCAs = certPool
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
86225b5 to
3991ab2
Compare
ee708fa to
237d1f4
Compare
12ee50c to
4b384b7
Compare
0462750 to
e43d580
Compare
The config-driven path builds its transport through oras-go's ClientBuilder, which falls back to http.DefaultTransport and skips TLS settings when that is not an *http.Transport. Use defaultTransport() as the builder's base so certs.d and CLI TLS settings apply, and move the NewTransport test onto the oras-go v3 packages. Signed-off-by: Terry Howe <[email protected]>
A signedBy or sigstoreSigned scope refused every push: oras-go verifies the manifest against the destination policy before uploading it, and a chart's manifest cannot be signed until it has been pushed. Push now evaluates the reference-level requirements (reject, insecureAcceptAnything) itself and copies without the evaluator, so signature requirements apply only when a chart is read, as with containers/image. Signed-off-by: Terry Howe <[email protected]>
Signed-off-by: Terry Howe <[email protected]>
oras-go v3.0.0-rc.5 evaluates only reference-level requirements on writes (oras-project/oras-go#1744), so Push no longer needs to strip the evaluator and check reject itself. TestPush_PolicyScopes keeps covering the behavior. Signed-off-by: Terry Howe <[email protected]>
Signed-off-by: Terry Howe <[email protected]>
3a8ae17 to
973813d
Compare
Store and remove namespaced credentials through remote.Login and remote.Logout instead of a hand-built key, so the path is validated and Docker Hub, which only reads credentials under its server address, rejects a namespaced login instead of storing a credential that is never found. Signed-off-by: Terry Howe <[email protected]>
…thorizer deprecation note Signed-off-by: Terry Howe <[email protected]>
Look up the certs.d directory by the host the client connects to, so docker.io uses registry-1.docker.io like Configs.RegistryProperties, and return a lookup failure instead of logging in without the certificates. Signed-off-by: Terry Howe <[email protected]>
LoginOptTLSClientConfig and LoginOptTLSClientConfigFromConfig panicked on an unreadable certificate, key or CA file, or on an HTTP transport they could not configure. Record the error like LoginOptInsecure does, so Login returns it before contacting the registry. Signed-off-by: Terry Howe <[email protected]>
LoginOptTLSClientConfig stored the certificate, key and CA paths on the client, and installed the certificate on the transport, before checking that every file loads. A failed Login then left settings behind that broke later operations on the same client. Load and check the files first, then apply them together. Signed-off-by: Terry Howe <[email protected]>
…roperties newRegistry re-implemented the registries.conf handling that Configs.RegistryProperties does for pull and push, and the copy only covered blocking, insecure and token-flow. Login now resolves its settings through Configs.RegistryProperties, so it also applies blocked-realm-prefixes, referrers-api and aliases, and reads certs.d for the canonical host it connects to. A host-only target is resolved with a placeholder repository, guarded so a path-scoped rule cannot match it, and newRegistry returns the canonical target so Login no longer applies the location rewrite itself. Signed-off-by: Terry Howe <[email protected]>
Move the container config stack settings, loaded configs, load error and policy evaluator into a containersConfig struct, and the TLS option settings into a tlsOverrides struct, so the Client fields read as the features they belong to. Signed-off-by: Terry Howe <[email protected]>
|
Ran the hosted-registry e2e suite (
In every job, both the registry configuration and the end-to-end test steps ran and passed. This also covers the token flow change: with oras-go v3, pulls and pushes with a username and password now try an OAuth2 POST first and fall back to the distribution GET flow. GitLab, whose token endpoint implements only the GET flow, and GHCR, which rejects the POST with |
Honor --plain-http when TLS flags are also set, so the TLS client path no longer silently dials HTTPS. Signed-off-by: Terry Howe <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because moderate hidden issues affect output integrity, consistent registry configuration across OCI operations, and alias-specific authentication and TLS behavior.
No open issues 🎉
1 resolved since last review
Review effort: Lite
- keep LoginOptBasicAuth credentials on the login operation so a reused client does not send them to other registries - share one auth cache across the clients the builder creates so tokens are reused between operations - restore the full login reference so remote.Login rejects a tag or digest - keep the oras-go v2 memory store at the GenericClient public boundary Signed-off-by: Terry Howe <[email protected]>


Summary
Migrates
helm.sh/helm/v4/pkg/registryfromoras.land/oras-go/v2togithub.com/oras-project/oras-go/v3(targeting v3.0.0) and wires in the full container ecosystem config stack behind the experimentalHELM_EXPERIMENTAL_CONTAINERS_CONFIGfeature gate.The public
pkg/registryAPI stays source compatible:oras.land/oras-go/v2remains a dependency only for theauth.Clienttype that the now-deprecatedClientOptAuthorizeraccepts.No new public option takes an oras-go type (such as a v3
auth.Clientorpolicy.Evaluator), so a future oras-go major version does not force another breaking change. Needs thatClientOptAuthorizercovered should be met by Helm options for the specific feature (credentials, headers, TLS, HTTP client) rather than by exposing the implementation.Part 1: Mechanical v2 → v3 migration
oras.land/oras-go/v2github.com/oras-project/oras-go/v3auth.Credentialcredentials.Credentialauthorizer.Credentialauthorizer.CredentialFuncfunc(ctx, hostport string)func(ctx, properties.Resource)credentials.Credential(store)remote.NewCredentialFunc(store)auth.StaticCredential(host, ...)credentials.StaticCredentialFunc(host, ...)ForceAttemptOAuth2remote.Login(ctx, putter, reg, cred)credentials.Logout(ctx, store, host)remote.Logout(ctx, deleter, properties.Resource{Registry: host})repo.PlainHTTP,repo.Clientrepo.Registry.PlainHTTP,repo.Registry.ClientDetectDefaultNativeStore: trueClientOptAuthorizerClientOptAuthorizer(auth.Client)auth.Client, now deprecated. Helm converts it to a v3 client (credential function, cache andForceAttemptOAuth2token flow carry over), so SDK callers keep compilingFeature gate:
HELM_EXPERIMENTAL_CONTAINERS_CONFIGParts 2–5 load files Helm has never read before, so they are experimental and off by default.
HELM_EXPERIMENTAL_CONTAINERS_CONFIG=1(gate ininternal/gates, next toHELM_EXPERIMENTAL_CHART_V3) loads the containers config stack and turns onpolicy.jsonenforcement andregistries.dsignature verification, as podman and buildah do for imagespkg/registrynever reads the env var. The newClientOptContainersConfig(bool)option (defaultfalse) loads the stack;ClientOptPolicyEnforcementandClientOptSignatureVerificationare still chosen separately and have no effect without itconfig.jsonas fallback, the same lookup asmaintoday. Noauth.json,registries.conf,certs.d,policy.jsonorregistries.dis read, and login/logout apply no location rewrite. The oras-go v3 migration (Part 1) applies either waysignedByrules forregistry.redhat.ioin/etc/containers/policy.json. With the gate on, unsigned charts from those registries are rejected until the policy is adjustedPart 2: Full config stack +
ClientBuilder.NewRepositoryconfig.LoadConfigsWithOptions()called inNewClient()when the containers config is enabled to load Dockerconfig.json, containersauth.json,registries.conf,certs.d,policy.json, andregistries.d. A file that exists but cannot be parsed does not failNewClient()(which runs for everyhelmcommand); the error is returned by the first registry operationClientBuilder.CredentialStore. oras-go'sremote.NewCredentialFuncmaps Docker Hub to its server address and walks namespaced credentials (host/a/b→host/a→host), so namespaced logins apply without Helm-side wrappersnewRepository()usesconfigs.RegistryProperties()+ClientBuilder.NewRepository()(andnewRegistry()usesClientBuilder.NewRegistry()) for mirror resolution, per-registry TLS, and CLI flag overrides--plain-http,--insecure-skip-tls-verify,--cert-file,--key-file,--ca-file,--username) applied viaapplyOverrides(). The CLI passes TLS flags through the newClientOptTLSClientConfigandClientOptInsecureSkipVerifyTLSoptions instead of a custom HTTP client, soregistries.confandcerts.dkeep applying when they are setClientOptHTTPClientorClientOptAuthorizeris usedcerts.dthe same way pull and push do: by the host the client connects to (registry-1.docker.iofordocker.io), and a lookup failure is returned instead of logging in without the certificatesNamespaced login and logout
helm registry login host/namespacestores the credential underhost/namespace(andhelm registry logout host/namespaceremoves it) through oras-go'sremote.Loginandremote.Logout, which validate the path. This replacesmain's warning that login only supports a hostname; the namespace walk in Part 2 makes the stored credential apply to repositories under itdocker.io/myorg), whose credentials are only looked up under its server address, and invalid repository paths. Log in todocker.iowithout a namespace insteadLogin TLS option errors
LoginOptTLSClientConfigandLoginOptTLSClientConfigFromConfigno longer panic on an unreadable certificate, key or CA file, or on an HTTP transport they cannot configure. LikeLoginOptInsecure, they record the error andLoginreturns it before contacting the registry; when several options fail, the first error is returnedLoginOptTLSClientConfigchecks every file before changing the client, so a failedLoginleaves no certificate, key or CA setting behind for later operations on the same clientLogininstead.helm registry loginalready returnedLogin's errors, so the CLI now prints an error rather than crashingPart 3: Policy enforcement (policy.json)
policy.jsonintoClientBuilderviabuilder.PolicyEvaluator; the builder sets it asRegistry.Policy, which the repository evaluates on read/write operationspolicy.jsonis written for container images, and itssignedBy/sigstoreSignedrequirements reject charts without a verifier, so it is only enforced whenClientOptPolicyEnforcement(true)orClientOptSignatureVerification(true)is set along withClientOptContainersConfig(true). The CLI sets all three when the feature gate is onPart 4: Signature verification (registries.d + signedBy)
signature.NewSignedByVerifierFromConfig+policy.WithSignedByVerifier) built fromregistries.dlookaside config and set as the repository'sRegistry.PolicyClientOptSignatureVerificationto enable/disablePart 5: Location rewrite (registries.conf)
Login()andLogout()apply theregistries.confLocationrewrite to the full input (including path-scoped rules such asalias.example/team), so credentials are stored and removed under the canonical registry name rather than an aliasproperties.Registry.Sourceand re-roots references naming the pre-rewrite location), so references are passed through unchangedDeprecation fixes
registry.ParseReferencewithproperties.NewReference.Referencefield access with.Tagonproperties.Referenceproperties.NewReferencerejects a dangling tag delimiter; Helm drops an empty tag (e.g.repo:@) first to keep accepting itCloses: #11771