-
Notifications
You must be signed in to change notification settings - Fork 74
Add "BaseTLS" options #623
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
base: main
Are you sure you want to change the base?
Conversation
aguidirh
left a comment
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.
Even with limited knowledge about the library, I tried my best to give my contribution o the code review.
common/pkg/download/download.go
Outdated
| // empty). | ||
| func FromURL(ctx context.Context, tmpdir, source string) (string, error) { | ||
| // If baseTLSConfig is not nil, it may contain TLS _algorithm_ options (e.g. TLS version, cipher suites, “curves”, etc.). | ||
| func FromURL(ctx context.Context, tmpdir, source string, baseTLSConfig *tls.Config) (string, error) { |
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.
Is this API used only internally? I'm asking because it is a breaking API change so I'm not sure the impact of it.
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.
How about extending the API by passing a struct and adding types on that struct? It could reduce frictio in future if the API needs to be extended again.
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.
c/common does not have a stable API commitment [and forcing callers to update means less risk of overlooking that we have to do something].
Using a struct here does make sense, I’ll update the PR.
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.
Updated.
| // We have already done this parsing in ParseReference, but thrown away | ||
| // httpClient. So, parse again. | ||
| // (We could also rework/split restClientFor to "get base URL" to be done | ||
| // in ParseReference, and "get httpClient" to be done here. But until/unless | ||
| // we support non-default clusters, this is good enough.) |
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.
Nice to see we are also maintaining the comments and not only the code. This is something rare, thanks!
|
Packit jobs failed. @containers/packit-build please check. |
|
Extended to also cover c/common/libimage. Fulcio + the related OIDC workflows are missing — we might need to change the clients upstream, or replace them. Other than that, this should be comprehensive for container-libs.
|
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
1d90952 to
b4a2bcd
Compare
The "parsing again" was removed in commit 35256ec . Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
There's really no benefit to it. Should not change (test) behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
We will replace the implementation Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
The underlying implementation is there, but it is not exposed in the API; we need an implementation for Fulcio + OIDC as well, and then we should decide whether the two get separate BaseTLS options, or whether we will do signature/sigstore.WithBaseTLS that applies to both. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
- Use a context to allow aborting, instead of silencing a relevant lint warning - Use a separate http.Client so that we don't share cookies with the rest of the process Signed-off-by: Miloslav Trmač <mitr@redhat.com>
... and allow configuring BaseTLS. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
It has no real users (one caller in Podman hard-codes it to nil), and it's unclear how it interacts with RuntimeOptions.SystemContext. Instead, it might make more sense to add more specific override options to CopyOptions, falling back on the runtime's SystemContext if unset. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
|
Minimal manual tests, using containers/skopeo#2797 : % cat tls-details-pqc-only.yaml
minVersion: "1.3"
namedGroups:
- "X25519MLKEM768"
# docker:
% bin/skopeo --tls-details ./tls-details-pqc-only.yaml inspect --raw docker://quay.io/foo
FATA[0000] Error parsing image name "docker://quay.io/foo": pinging container registry quay.io: Get "https://quay.io/v2/": EOF
# oci:
# manually prepared image, with manifest
% cat oci-layout/blobs/sha256/8083ab158310d4a23b04ff72f5485fe913c457e033811c159e4314f095492378
{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"config": {
"mediaType": "application/vnd.oci.image.config.v1+json",
"digest": "sha256:31003e2979e8f5fec9358644591ce51df452fb489624bd09a999f2d6e091e936",
"size": 604
},
"layers": [
{
"mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"digest": "sha256:161a397ac5ee9e631cd79cdfb5f0b36a861071d42e67afe98ed3cb69155ea5ff",
"size": 2776947,
"urls": ["https://quay.io/v2/"]
}
]
}
% bin/skopeo --insecure-policy --tls-details ./tls-details-pqc-only.yaml copy oci:oci-layout dir:t2
Getting image source signatures
Copying blob 161a397ac5ee [--------------------------------------] 0.0b / 2.6MiB | 0.0 b/s
FATA[0000] reading blob sha256:161a397ac5ee9e631cd79cdfb5f0b36a861071d42e67afe98ed3cb69155ea5ff: fetching "https://quay.io/v2/" failed Get "https://quay.io/v2/": EOF: failed fetching external blob from all urls
# atomic:
% KUBERNETES_MASTER=https://quay.io/ bin/skopeo --tls-details ./tls-details-pqc-only.yaml inspect --raw atomic:quay.io:443/foo/bar:baz
FATA[0000] Error retrieving manifest for image: Get "https://quay.io/oapi/v1/namespaces/foo/imagestreams/bar": EOF
# docker-daemon:
% bin/skopeo --tls-details ./tls-details-pqc-only.yaml inspect --daemon-host=https://quay.io --raw docker-daemon:foo:bar
FATA[0000] Error parsing image name "docker-daemon:foo:bar": loading image from docker engine: error during connect: Get "https://quay.io/v1.53/images/get?names=foo%3Abar": EOF Untested: |
For now absolutely untested, andwith Rekor+Fulcio not configurable.On top of #619.