sigstore / root-signing

TUF repository for Sigstore trust root
Apache License 2.0
85 stars 81 forks source link

Why are snapshot role hashes not provided in the timestamp role? #1388

Closed lsd-cat closed 1 week ago

lsd-cat commented 1 week ago

From the TUF spec, 5.5.2:

Check against timestamp role’s snapshot hash. The hashes of the new snapshot metadata file MUST match the hashes, if any, listed in the trusted timestamp metadata. This is done, in part, to prevent a mix-and-match attack by man-in-the-middle attackers. It is safe to check the hashes before the signatures, because the hashes come from the timestamp role, which we have already verified in the previous step; it is also a quick way to reject bad metadata. If the hashes do not match, discard the new snapshot metadata, abort the update cycle, and report the failure.

It seems like no hashes are published https://tuf-repo-cdn.sigstore.dev/timestamp.json. They mention man-in-the-middle, but I guess the same could be achieved by a server compromise, so TLS would protect in one case but not the other. Is there a reason why this is not considered useful?

jku commented 1 week ago

There is an advantage to using hashes but it's not in my opinion a massive one:

So using hashes could be useful but not a game changer. The main reason hashes are not currently used (in addition to making the metadata files larger) is that maintaining the repository becomes a little more complicated with hashes -- while tuf-on-ci tool was being developed we really tried to keep it simple and did not originally implement hashes. We could consider adding that now that things seem to be working solidly.

Another reason some people might avoid the hashes is that it does prevent a use case where additional signatures are added after the metadata is published (Imagine a case where published metadata was signed by threshold of signers but not all of the signers, and then the remaining signers still want to sign) . To be fair this sounds unusual and tuf-on-ci certainly does not do this.

lsd-cat commented 1 week ago

Hey, thank you for the detailed explanation. I am mostly asking for both curiosity of TUF internals and being sure I implement a reasonably secure client. This really helps.