Skip to content

How to get the Fulcio root certificate securely in verify-blob? #2134

Closed
@wata727

Description

First of all, thank you for the great project and everyone involved in it. I'm a maintainer of an OSS project using cosign to sign release binaries. Our project uses GoReleaser for signing, and we run the following commands on the checksum:

COSIGN_EXPERIMENTAL=1 cosign sign-blob --output-certificate=checksum.txt.pem --output-signature=checksum.txt.keyless.sig checksum.txt

https://github.com/terraform-linters/tflint/blob/e7668cb182999e93a2e79534968d8ad686c14f14/.goreleaser.yml#L26-L37

To verify this, we provide a verification example as follows:

cosign verify-blob --cert checksums.txt.pem --signature checksums.txt.keyless.sig --certificate-github-workflow-repository=terraform-linters/tflint checksums.txt

https://github.com/terraform-linters/tflint/blob/e7668cb182999e93a2e79534968d8ad686c14f14/README.md#verification

However, I understand that this way does not verify the checksum.txt.pem's certificate chain against the Fulcio root trust, so it is not sufficient:
https://github.com/sigstore/cosign/blob/v1.10.1/cmd/cosign/cli/verify/verify_blob.go#L122-L129

To avoid this, I understand that I need to pass the Fulcio root certificate with the --certificate-chain option:
https://github.com/sigstore/cosign/blob/v1.10.1/cmd/cosign/cli/verify/verify_blob.go#L131-L139

Now the question is, how can I get this root certificate securely?

I have confirmed that I can get certificates locally using TUF by cosign initialize. I can use this to build a certificate chain like this:

cosign initialize
cat ~/.sigstore/root/targets/fulcio_intermediate_v1.crt.pem > fulcio_chained.crt.pem
echo >> fulcio_chained.crt.pem
cat ~/.sigstore/root/targets/fulcio.crt.pem >> fulcio_chained.crt.pem
echo >> fulcio_chained.crt.pem
cat ~/.sigstore/root/targets/fulcio_v1.crt.pem >> fulcio_chained.crt.pem

cosign verify-blob --cert checksums.txt.pem --cert-chain fulcio_chained.crt.pem --signature checksums.txt.keyless.sig --certificate-github-workflow-repository=terraform-linters/tflint checksums.txt
Verified OK

But I'm not sure I can trust this local cache. In my opinion, it's safest to also get this root certificate by the TUF client, like COSIGN_EXPERIMENTAL=1 cosign verify-blob:
https://github.com/sigstore/cosign/blob/v1.10.1/cmd/cosign/cli/verify/verify_blob.go#L220-L227

What do you think about this? Is there a better way?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions