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

Signatures in DSSE envelopes for intoto/v0.0.2 are double encoded #1139

Closed
kommendorkapten opened this issue Oct 21, 2022 · 6 comments · Fixed by #1150
Closed

Signatures in DSSE envelopes for intoto/v0.0.2 are double encoded #1139

kommendorkapten opened this issue Oct 21, 2022 · 6 comments · Fixed by #1150
Labels
bug Something isn't working

Comments

@kommendorkapten
Copy link
Member

Description

When uploading an intoto object with version 0.0.2, the retrieved entry has the signature double base64 encoded.

An example entry with this:

Created entry at index 5547337, available at: https://rekor.sigstore.dev/api/v1/log/entries/24296fb24b8ad77a5f9c879a81d619af36c272b25889758a7855a31c7e4b27d51d1b0b943d2aabc2

When retrieving the entry:

...
    "content": {
      "envelope": {
        "payloadType": "application/vnd.in-toto+json",
        "signatures": [
          {
            "publicKey": "LS0...",
            "sig": "TUVVQ0lDZWNWcS9lckI3MU4xRm5PYVpnV0l1OHBnb1h4QXM2N212NUpXd0JIR05KQWlFQWxwRjY4N0lHNnF5L0NOTmYwZmE4OFdhWVR2RVJsOEhjeXhoVFgzQWZYTVk9"
          }
...

After base64 decode the signature, we get the real signature:

$ printf TUVVQ0lDZWNWcS9lckI3MU4xRm5PYVpnV0l1OHBnb1h4QXM2N212NUpXd0JIR05KQWlFQWxwRjY4N0lHNnF5L0NOTmYwZmE4OFdhWVR2RVJsOEhjeXhoVFgzQWZYTVk9 | base64 -D
MEUCICecVq/erB71N1FnOaZgWIu8pgoXxAs67mv5JWwBHGNJAiEAlpF687IG6qy/CNNf0fa88WaYTvERl8HcyxhTX3AfXMY=

which was uploaded:

$ grep 'sig"' envelope
                "sig": "MEUCICecVq/erB71N1FnOaZgWIu8pgoXxAs67mv5JWwBHGNJAiEAlpF687IG6qy/CNNf0fa88WaYTvERl8HcyxhTX3AfXMY="

Version

Rekor as deployed of 2022-10-21.

@kommendorkapten kommendorkapten added the bug Something isn't working label Oct 21, 2022
@kommendorkapten
Copy link
Member Author

I understand this is a known issue: https://sigstore.slack.com/archives/C01CX4E2K70/p1664483571881309, should I close this?

@bobcallaway
Copy link
Member

which client is being used to upload?

@kommendorkapten
Copy link
Member Author

I was using a local built rekor-cli, at the current main branch a few days ago.
This was also asked in #rekor slack channel September 29th, and @haydentherapper answered it was due to historical decisions.

I was testing this locally too, and I think I tcpdumped the bytes on the wire to verify that the envelope being sent wasn't double encoded, but I don't that data available now. I can re-run the test next week.

@bobcallaway
Copy link
Member

no need, that's enough of a direction for me to look at. thanks!

@bdehamer
Copy link

I was looking at this a few weeks back to understand how to implement this properly in sigstore-js. When I spied on the request that was being made by the rekor-cli I saw that both the envelope payload and the signature were double base64-encoded on upload.

$ go run cmd/rekor-cli/main.go upload --artifact /tmp/dsse --type intoto:0.0.2 --public-key /tmp/cert.pem                     
Created entry at index 4238416, available at: https://rekor.sigstore.dev/api/v1/log/entries/24296fb24b8ad77ac02225838452ac7595971bf1fac127332bb6b4ea3c1fd7528ea70a042776d302
{
  "apiVersion":"0.0.2",
  "kind":"intoto",
  "spec":{
    "content":{
      "envelope":{
        "payload":"ZXdvZ0lDSmZkSGx3WlNJNklDSm9kSFJ3Y3pvdkwybHVMWFJ2ZEc4dWFXOHZVM1JoZEdWdFpXNTBMM1l3TGpFaUxBb2dJQ0p6ZFdKcVpXTjBJam9nV3dvZ0lDQWdld29nSUNBZ0lDQWlibUZ0WlNJNklDSnpiSE5oTFhCeWIzWmxibUZ1WTJVdE1DNHdMakV1ZEdkNklpd0tJQ0FnSUNBZ0ltUnBaMlZ6ZENJNklIc0tJQ0FnSUNBZ0lDQWljMmhoTlRFeUlqb2dJbUppWm1Rek56Sm1ZemxpWldWaU56YzNabVV6TldRd05XSmlNVEJqTUdNM01HRTVOek16WkRNMk5tRTNOV1psWkRka1pERTRPRFkyWXpjek9URmtaVE5sWlRkbE9EaGlZVGMwWkdRME4yRmla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0dQbVg1NWtyOUhDdjhudlpSZ2R5bkllL2Z2WkRhNWdXZjM5LzBDNzF3K2VTVkFDY1NzcGcKS0N3Q01CTWx3MnpqaVJPeE5MeFBGNVV6N0JlaGxha2hYdm9tN1lpQjN3ZktGZjBJSTFPYXYwcTdKclNlQzBaKwptMURrd1E9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==",
            "sig":"TUVZQ0lRQ3IxSXlsUTBHUnFqMEFCbm8zNmlOL1d1MFFpYncwUTY2d08xOGcvSnNHNFFJaEFJMlZBTUFTa2hRTTdDd3U2a29BKzBzbWF2WGRKUDJIK0cvOWlmUlRoa085"
          }
        ]
      },
      "hash":{
        "algorithm":"sha256",
        "value":"d0dd92729d5d6273186f9083dccc4c53f0eb9d13f6f61b79bdbad22abbdb8aca"
      }
    }
  }
}

@haydentherapper
Copy link
Contributor

@bobcallaway Can this be closed as won't fix? We've now got the DSSE type that should fix this

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

Successfully merging a pull request may close this issue.

4 participants