rekor
rekor copied to clipboard
in-toto verify-blob verification fails to find the tlog entry. Mismatch in index vs. search
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
@tstromberg, any thoughts here? I thought your sigstore-the-local-way chops might lead to an intuition.
@asraa Is this complete?
I think so. Two things:
- There is now a
verify-blob-attestation
command that one can use instead of theverify-blob
. - 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