Skip to content
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

feat: verify cosign signatures in OCI-SIF #3512

Merged
merged 1 commit into from
Feb 10, 2025
Merged

Conversation

dtrudg
Copy link
Member

@dtrudg dtrudg commented Feb 6, 2025

Description of the Pull Request (PR):

Adds a --cosign mode to singularity verify. In this mode:

  • The digests of each OCI blob in an OCI SIF are verified vs descriptor data.
  • For a single OCI image in the SIF, cosign signatures are verified using the provided public --key, and the payload checked for a match to the image digest.
  • If no cosign signatures are valid with the provided key material, verify exits with a fatal error.
  • If one or more cosign signatures are valid with the provided key material, verify outputs their payloads (JSON).

This fixes or addresses the following GitHub issues:

Before submitting a PR, make sure you have done the following:

@dtrudg dtrudg added this to the SingularityCE 4.3.0 milestone Feb 6, 2025
@dtrudg dtrudg marked this pull request as ready for review February 6, 2025 13:40
Copy link
Member

@tri-adam tri-adam left a comment

Choose a reason for hiding this comment

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

LGTM, basic functionality working here:

$ singularity verify --cosign --key cosign.pub alpine.sif 
INFO:    Verifying image with sigstore/cosign signature, using key material from 'cosign.pub'
INFO:    Verifying digests for 6 OCI Blobs
INFO:    Image digest: sha256:0111d2449f7e37f4d29f606a71be1a9c0d2fe941c66c621953aa87fcc05b6802
INFO:    Image has 1 associated signatures
INFO:    Image has 1 signatures that are valid with provided key material
[{"critical":{"identity":{"docker-reference":""},"image":{"docker-manifest-digest":"sha256:0111d2449f7e37f4d29f606a71be1a9c0d2fe941c66c621953aa87fcc05b6802"},"type":"cosign container image signature"},"optional":{"creator":"Singularity-Ce/4.2.0 (Linux amd64) Go/1.23.2","timestamp":1738978687}}]

Adds a `--cosign` mode to `singularity verify`. In this mode:

* The digests of each OCI blob in an OCI SIF are verified vs
descriptor data.
* For a single OCI image in the SIF, cosign signatures are verified
using the provided public `--key`, and the payload checked for a match
to the image digest.
* If no cosign signatures are valid with the provided key material,
`verify` exits with a fatal error.
* If one or more cosign signatures are valid with the provided key
material, `verify` outputs their payloads (JSON).

Closes sylabs#3493
@dtrudg dtrudg merged commit 1534cb7 into sylabs:main Feb 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify OCI-SIF (cosign/sigstore)
2 participants