feat(oci-client): use plain HTTP for loopback registries#807
Open
jtsylve wants to merge 1 commit into
Open
Conversation
`OciClientDriver::get_metadata` builds its oci-client with `ClientConfig::default()`, whose protocol is HTTPS. The CLI also links reqwest with `rustls-tls` (webpki roots) and hardcodes `accept_invalid_certificates: false`, so a self-signed TLS registry is not trusted either. The result: `bluebuild build` cannot inspect an image on a plain-HTTP local registry — the post-push manifest fetch fails with a connect error against `https://localhost:5000/...`. Treat loopback registries (localhost, 127.0.0.0/8, ::1 — any port) as plain HTTP, exactly as cosign, containerd, and docker already do. Everything else stays HTTPS, so there is no behavior change for real registries and no new configuration to set. The loopback-host detection is factored into a `is_loopback_registry` helper (handling optional ports and bracketed IPv6 literals) with unit tests. Signed-off-by: Joe Sylve <joe.sylve@gmail.com>
gmpinder
requested changes
Jul 1, 2026
| mod test { | ||
| use super::is_loopback_registry; | ||
|
|
||
| #[test] |
Member
There was a problem hiding this comment.
Try making use of rstest instead
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.
OciClientDriver::get_metadatabuilds its oci-client withClientConfig::default(), whose protocol is HTTPS. The CLI also links reqwest withrustls-tls(webpki roots) and hardcodesaccept_invalid_certificates: false, so a self-signed TLS registry is not trusted either. The result:bluebuild buildcannot inspect an image on a plain-HTTP local registry — the post-push manifest fetch fails with a connect error againsthttps://localhost:5000/....Change
Treat loopback registries (
localhost,127.0.0.0/8,::1— any port) as plain HTTP, exactly as cosign, containerd, and docker already do. Everything else stays HTTPS, so there is no behavior change for real registries and no new configuration to set.Notes
is_loopback_registryhelper that handles an optional:portsuffix and bracketed IPv6 literals, with unit tests covering loopback (incl.127.0.0.0/8,::1,[::1]:5000) and remote (incl.2001:db8::1,localhost.example.com) cases.oci-clienthas no auto-negotiating protocol (onlyHttp/Https/HttpsExcept). The client is built per-registry and only ever contacts the already-confirmed-loopback registry, soClientProtocol::Httpis used directly.cargo fmt --check,cargo clippy, and the new unit tests pass.