rekor icon indicating copy to clipboard operation
rekor copied to clipboard

Add endpoint for hash algorithm used during signing.

Open kommendorkapten opened this issue 3 years ago • 4 comments

Description

Today the public key can be retrieved via the API. For signature algorithms that rely on a hash function, the used hash function can not be retrieved via the API. Current Rekor cli assumes the hash function is SHA-256: https://github.com/sigstore/rekor/blob/main/cmd/rekor-cli/app/log_info.go#L190

Also, if the signing algorithm used is RSA, PKCS1 1.5 is assumed: https://github.com/sigstore/sigstore/blob/d59ee8fee91d9e1e1f5aeae9347a69ff3439ea29/pkg/signature/verifier.go#L45 This information should also be available via the API.

When relying on TUF for key distribution, those parameters should of course preferably be part of the TUF metadata.

kommendorkapten avatar Sep 16 '22 11:09 kommendorkapten

When relying on TUF for key distribution, those parameters should of course preferably be part of the TUF metadata.

I think we should probably just require that these parameters be distributed out-of-band always; otherwise, it feels like an attack vector (I can MITM the connection to Rekor, tell you to use CRC32, and forge signatures).

znewman01 avatar Sep 19 '22 14:09 znewman01

I think we should probably just require that these parameters be distributed out-of-band always;

Yes, that is of course the best. I was a bit puzzled as the public key is available via the API, but not the parameters.

kommendorkapten avatar Sep 19 '22 14:09 kommendorkapten

Makes sense.

Yeah, I think it's fair to want either both or neither, and maybe we should prefer neither.

znewman01 avatar Sep 19 '22 14:09 znewman01

and maybe we should prefer neither.

Yes, as that will not foster unsafe behaviour. For testing where the default is to use an in-memory generated key-pair, there has to be a way to extract the key at least. But there are other ways than via the API. Maybe one way is to not expose the endpoint for retrieving the public key, and require an explicit parameter to expose it (for local testing).

kommendorkapten avatar Sep 19 '22 14:09 kommendorkapten

Closing - Decision is that this should be provided out of band

Hayden-IO avatar Jan 03 '23 05:01 Hayden-IO