Skip to content

Conversation

bitoku
Copy link

@bitoku bitoku commented Sep 3, 2025

This PR is copied from containers/image#2934 .

This PR adds PutSignaturesWithFormat/GetSignaturesWithFormat support to OCI layout.
The general idea is tag-based discovery, same as sigstore signature discovery.

It stores the signature with annotation org.opencontainers.image.ref.name: "sha256-<hash>.sig", which can be used as a tag. https://specs.opencontainers.org/image-spec/image-layout/#IMAGE-SPEC-IMAGE-LAYOUT-19

Fixes #186

@github-actions github-actions bot added the image Related to "image" package label Sep 3, 2025
Copy link

Packit jobs failed. @containers/packit-build please check.

Copy link
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: previously containers/image#2934 (review) .

@mtrmac
Copy link
Contributor

mtrmac commented Sep 3, 2025

The common/pkg/manifests/manifests_test.go tests might be fixed by #314.

The “Skopeo test” failures here look relevant, I’m not immediately sure (I’m afraid I didn’t yet read the updated version of this PR) whether they are bugs to be fixed here, or whether the tests will need to be adjusted.

@bitoku
Copy link
Author

bitoku commented Sep 5, 2025

This is the commit ffcc126 to fix the CI

@bitoku bitoku requested a review from mtrmac September 5, 2025 12:41
@bitoku
Copy link
Author

bitoku commented Sep 16, 2025

@mtrmac PTAL when you have a moment. thanks!

Copy link
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and I apologize for the delay.


import (
"context"
"encoding/json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m afraid this is not documented anywhere, but the *_transport.go files primarily deal with image references and naming; and because image identity is critical for preserving the users’ intent when verifying signatures, we want as good unit test coverage as possible for *_transport.go.

That’s, in principle, an option, but it might be easier to move some of the helper functions to oci_src.go or oci_dest.go, where the unit test coverage requirements are much more pragmatic. E.g. getOCIDescriptorContents seems to have a single caller outside of this file, so it can be moved closer to the caller; probably similarly for getBlob and others.

Also, getManifestDescriptor should have unit test coverage for the new code paths.

Copy link
Author

@bitoku bitoku Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to do that, but some functions are used in oci_src.go and oci_dest.go. To avoid cyclic dependency, I did this way.
getOCIDescriptorContents is used in both src and dest after addressing #312 (comment)
getBlob is used in getSigstoreAttachmentManifest and getOCIDescriptorContents, which are used in both src and dest.

I don't like putting everything in transport either. If we have any idea to fix this complexity, I'm happy to change that.

Also, getManifestDescriptor should have unit test coverage for the new code paths.

👍

podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Sep 24, 2025
@podmanbot
Copy link

✅ A new PR has been created in buildah to vendor these changes: containers/buildah#6394

podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Sep 24, 2025
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Sep 24, 2025
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Sep 24, 2025
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Sep 24, 2025
@bitoku bitoku force-pushed the layout-signature branch 2 times, most recently from 811a527 to e61dbb7 Compare September 30, 2025 16:19
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Sep 30, 2025
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Sep 30, 2025
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Sep 30, 2025
Signed-off-by: Ayato Tokubi <[email protected]>
Signed-off-by: Ayato Tokubi <[email protected]>
Signed-off-by: Ayato Tokubi <[email protected]>
Refactor `digestPart` validation by replacing `Validate` with `Parse` for clarity and correctness

Use signDesc MediaType to validate signature MIMEType.

Signed-off-by: Ayato Tokubi <[email protected]>
…teCandidates` and improving unused blob handling

Remove redundant implementation in `ociImageDestination`

Simplify error handling in putSignaturesToSigstoreAttachment logic

Normalize error message for sigstore signature support in OCI layout

Add comment clarifying manifest digest requirement in PutSignaturesWithFormat

Clarify comment for `manifestDigest` field in `ociImageDestination`

Signed-off-by: Ayato Tokubi <[email protected]>
…tSignaturesWithFormat

Remove unused `impl.NoSignatures` from `ociImageSource` structure

Simplify `GetSignaturesWithFormat` by removing redundant nil check for `instanceDigest`

Signed-off-by: Ayato Tokubi <[email protected]>
…improved readability and maintainability.

Signed-off-by: Ayato Tokubi <[email protected]>
…d `getSigstoreAttachmentManifest`

Signed-off-by: Ayato Tokubi <[email protected]>
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Sep 30, 2025
Signed-off-by: Ayato Tokubi <[email protected]>
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Oct 1, 2025
@bitoku
Copy link
Author

bitoku commented Oct 1, 2025

@mtrmac I'd appreciate if you could give another round of review.
I'll fix validate / git-validate (pull_request) when everything is sorted out.

@mtrmac mtrmac added the enhancement New feature or request label Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request image Related to "image" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support OCI layout signature storage

3 participants