-
Notifications
You must be signed in to change notification settings - Fork 154
Handle signing and attesting blobs #1395
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
|
The following is the coverage report on the affected files.
|
|
/lgtm |
|
@mathur07: changing LGTM is restricted to collaborators DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
| } | ||
| se, err := ociremote.SignedEntity(req.Artifact, ociremote.WithRemoteOptions(s.remoteOpts...)) | ||
| if err != nil { | ||
| if _, isEntityNotFoundErr := err.(*ociremote.EntityNotFoundError); isEntityNotFoundErr { |
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.
Whenever there is an entity not found we are default considering it as a blob, what if the digest was incorrect or the blob is not there? Is there a possibility to check if such a blob exists before attesting?
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.
The code is not necessarily handling a blob but it's handling the case where the image reference does not reference an existing Image Manifest or Image Index. It just so happens that this is what makes the blob signing/attesting work. I linked in the description how cosign itself implements this logic. I think it's safe to copy what they're doing there.
|
@lcarva Could you help clarify the scenario in which Tekton PRs or TRs would result in standalone blobs being pushed to container registries (i.e., not part of an image or manifest)? From my understanding, typical Tekton outputs are full OCI images. Are there cases where individual blobs are pushed independently and need signing or attestation support? This context would help in understanding the need for handling blob references explicitly in this logic. |
Chains fetches existing information about the container images it signs and attests. This works well when the image reference refers to an Image Index or an Image Manifest since those are served from the same endpoint in a container registry. However, when fetching information about a blob (layer) a different endpoint is needed. Cosign handles this behavior by making this step optional: https://github.com/sigstore/cosign/blob/c86498055d0c4ea2f39076064aa094db12f85f6a/cmd/cosign/cli/sign/sign.go#L181-L186 Thus it is possible to sign/attest a blob with the cosign CLI. This commit implements the same logic to Chains so it can also sign/attest blobs. Signed-off-by: Luiz Carvalho <[email protected]>
3b48cfd to
512c64b
Compare
It's really up to a Task. With something like oras, I can push individual blobs to the registry and emit those references in my Task result. The use case I'm exploring that highlighted this was that I was using a Tekton Task to build a python wheel. I want to make sure the digest of the wheel (same as the digest of the blob) is in the SLSA Provenance. |
|
The following is the coverage report on the affected files.
|
| } | ||
|
|
||
| ctx := logtesting.TestContextWithLogger(t) | ||
| _, err = storer.Store(ctx, &api.StoreRequest[name.Digest, *intoto.Statement]{ |
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.
Any chance we can assert the output anyway ?
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.
I don't think that's important. It looks like the Store method is half-baked and always returns &api.StoreResponse{}.
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.
Yeah I did check that, but thought if we can assert the logs, but that should be fine as we are check if the error is nil or not
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: PuneetPunamiya The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm Not sure if I can do this 🙏 |
|
@lcarva: you cannot LGTM your own PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/lgtm |
Changes
Chains fetches existing information about the container images it signs and attests. This works well when the image reference refers to an Image Index or an Image Manifest since those are served from the same endpoint in a container registry. However, when fetching information about a blob (layer) a different endpoint is needed.
Cosign handles this behavior by making this step optional: https://github.com/sigstore/cosign/blob/c86498055d0c4ea2f39076064aa094db12f85f6a/cmd/cosign/cli/sign/sign.go#L181-L186
Thus it is possible to sign/attest a blob with the cosign CLI. This commit implements the same logic to Chains so it can also sign/attest blobs.
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
Release Notes