-
Notifications
You must be signed in to change notification settings - Fork 55
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
Verify not working if the certificate annotation is present and there is no bundle annotation #135
Comments
Assigned to @raulcabello, who is already looking into that |
We are always trying to verify that the certificate in the It is possible that this certificate was not issued by fulcio. This certificate can be added when signing with We can add a flag similar to What do you think about this approach? |
The `cosign` tool can produce signatures using a PKCS11 token. These signatures feature a `certificate` annotation inside of their OCI layer. However, when `COSIGN_EXPERIMENTAL` is not enabled, the layer will not feature a Rekor bundle. Prior to this commit, the code assumed signature layers could have a `certificate` annotation only when using the Fulcio integration. Because of that, layers with a `certificate` but without a Rekor bundle were discarded. That was done to ensure the robustness of keyless verification. This commit changes the code that creates `SignatureLayer` objects to not raise errors when an embedded certificate cannot be verified. Be it because it has been forged/invalid/etc or because the Rekor bundle is not found inside of the layer. The resulting `SignatureLayer` will not be discarded, but it will have its `certificate_signature` attribute set to `None`. > **Note:** `SignatureLayer::certificate_signature` was already a `Option` > before of this commit. The verification constraints implementing keyless verification will discard these kind of layers because they do not have a `certificate_signature`. However, the public key based verifier will be able to verify the signature stored inside of the layer. This solves the following scenario: > As a user, > Given Alice signed a container image using a PKCS11 token but without having cosign's Rekor integration enabled > When verifying the container image signature using the public key associated with the certificate stored on her PKCS11 token > Then the container image will be reported as successfully verified Fixes sigstore#135 Signed-off-by: Flavio Castelli <fcastelli@suse.com>
The `cosign` tool can produce signatures using a PKCS11 token. These signatures feature a `certificate` annotation inside of their OCI layer. However, when `COSIGN_EXPERIMENTAL` is not enabled, the layer will not feature a Rekor bundle. Prior to this commit, the code assumed signature layers could have a `certificate` annotation only when using the Fulcio integration. Because of that, layers with a `certificate` but without a Rekor bundle were discarded. That was done to ensure the robustness of keyless verification. This commit changes the code that creates `SignatureLayer` objects to not raise errors when an embedded certificate cannot be verified. Be it because it has been forged/invalid/etc or because the Rekor bundle is not found inside of the layer. The resulting `SignatureLayer` will not be discarded, but it will have its `certificate_signature` attribute set to `None`. > **Note:** `SignatureLayer::certificate_signature` was already a `Option` > before of this commit. The verification constraints implementing keyless verification will discard these kind of layers because they do not have a `certificate_signature`. However, the public key based verifier will be able to verify the signature stored inside of the layer. This solves the following scenario: > Given Alice signed a container image using a PKCS11 token but without having cosign's Rekor integration enabled > When verifying the container image signature using the public key associated with the certificate stored on her PKCS11 token > Then the container image will be reported as successfully verified Fixes sigstore#135 Signed-off-by: Flavio Castelli <fcastelli@suse.com>
Description
Both certificate and bundle are optional parameters when signing with cosign. If the certificate annotation is present and there is no bundle annotation, verification fails with the following error:
This happens when providing a certificate when signing with
cosign
using a keypair and without enablingCOSIGN_EXPERIMENTAL
How to reproduce it?
raulcabm/sigstore-test:1
was signed with cosign and pkcs11.dev.cosignproject.cosign/signature
anddev.sigstore.cosign/certificate
annotations are present, which is a valid scenario.crane manifest $(cosign triangulate raulcabm/sigstore-test:1) | jq
Verification with
cosign
is successful, howeversigstore-rs
returns theSigstoreRekorBundleNotFoundError
error. This can be tested with:Version
v0.4.0
This issue was raised in kubewarden/verify-image-signatures#20 (comment)
The text was updated successfully, but these errors were encountered: