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

in-toto verify-blob verification fails to find the tlog entry. Mismatch in index vs. search #646

Closed
vaikas opened this issue Feb 1, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@vaikas
Copy link
Contributor

vaikas commented Feb 1, 2022

Description

While playing with Tekton Chains and trying to use in-toto attestations, it appears that they get inserted into Rekor just fine, but then cosign is unable to find them based on the payload.

Tekton creates the following payload:

vaikas@villes-mbp cosign % cat payload| jq .
{
  "_type": "https://in-toto.io/Statement/v0.1",
  "predicateType": "https://slsa.dev/provenance/v0.2",
  "subject": [
    {
      "name": "gcr.io/foo/bar",
      "digest": {
        "sha256": "05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b5"
      }
    }
  ],
<snipped>

And what is jotted into the Redis index is sha256:8e16392eccfa66f58cb496dc08f680c6ffe06d1ae8975b6c8ae347e35142aec3

But when I go to verify-blob, the sha that's constructed is the shasum of the payload and there's no index for it, therefore cosign verify-blob won't find the tlog entry and verification fails.

Here's a locally modified (adding the printf just displaying what cosign looks for) as well as the payload it's trying to find, showing it's the shasum of the entire payload.

vaikas@villes-mbp cosign % shasum -a 256 ./payload
aeeb7e1cc333c7667056c6287f904dc26d4ad8a28e649a6e98802f5436b54c1a  ./payload
vaikas@villes-mbp cosign % SIGSTORE_ROOT_FILE=../../vaikas/build-playground/fulcio-public.pem COSIGN_EXPERIMENTAL=1 ./main -d verify-blob  --rekor-url=http://rekor.rekor-system.svc:8080 --signature ./signature ./payload
LOOKING FOR HASH: sha256:aeeb7e1cc333c7667056c6287f904dc26d4ad8a28e649a6e98802f5436b54c1aError: verifying blob [./payload]: could not find a tlog entry for provided blob
main.go:46: error during command execution: verifying blob [./payload]: could not find a tlog entry for provided blob

Possibly related to #582

@vaikas vaikas added the bug Something isn't working label Feb 1, 2022
@jspeed-meyers
Copy link
Contributor

jspeed-meyers commented Feb 9, 2022

@tstromberg, any thoughts here? I thought your sigstore-the-local-way chops might lead to an intuition.

@haydentherapper
Copy link
Contributor

@asraa Is this complete?

@asraa
Copy link
Contributor

asraa commented Jan 3, 2023

I think so. Two things:

  1. There is now a verify-blob-attestation command that one can use instead of the verify-blob.
  2. I think the flow works, or at least experimentally I tried this out:
$ COSIGN_EXPERIMENTAL=1 ./cosign attest-blob README.md --predicate predicate.json  --key cosign.key  --output-signature attestation.json
Using payload from: README.md
Using predicate from: predicate.json
Enter password for private key: 
tlog entry created with index: 10398047
Signature written in attestation.json
$ sha256sum  attestation.json 
876ca6a8d9f4075c4c47d95fc99abab31dc49023b29d836072bd8eec9dc7ab83  attestation.json
$ ./rekor search --sha 876ca6a8d9f4075c4c47d95fc99abab31dc49023b29d836072bd8eec9dc7ab83
Found matching entries (listed by UUID):
24296fb24b8ad77ac14dd9d5c0bcb7f0d2a972aa0de3e1801c65f4bf7fc2b377dee3be27179a5fbd

@asraa asraa closed this as completed Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants