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

FileMeta verification guidance with client store representations #249

Open
asraa opened this issue Sep 15, 2022 · 2 comments
Open

FileMeta verification guidance with client store representations #249

asraa opened this issue Sep 15, 2022 · 2 comments

Comments

@asraa
Copy link
Contributor

asraa commented Sep 15, 2022

sigstore/root-signing#376 (comment)
@kommendorkapten brought up this issue during a change where we used to serve canonicalized repository metadata, and just now switched to normal encoding/json. This technically changes the bytes that are used to calculate the FileMeta checksum and lengths, for example, used in the timestamp.json file for pinning the snapshot.

If clients write metadata to their trusted store in canonicalized form, or in some other representation other than the bytes that were directly received from the repository, then the checksums of their stored metadata no longer match the ones in the trusted FileMeta.

This is particularly important if we have a shared cache that multiple TUF client implementations share: if one writes as canonicalized bytes, and the other in the direct bytes received, then one client will fail depending on the way that the repository wrote the FileMeta.

Should clients ALWAYS write metadata to their trusted store in the exact form that was received from the remote?
Should FileMeta ALWAYS be generated from the canonicalized bytes that were signed?

@trishankatdatadog
Copy link
Member

Should clients ALWAYS write metadata to their trusted store in the exact form that was received from the remote?
Should FileMeta ALWAYS be generated from the canonicalized bytes that were signed?

Seems like a reasonable (albeit slightly expensive) workaround for now. Does anyone else have better ideas?

@lukpueh
Copy link
Member

lukpueh commented Oct 3, 2022

Should clients ALWAYS write metadata to their trusted store in the exact form that was received from the remote?
Should FileMeta ALWAYS be generated from the canonicalized bytes that were signed?

It's either one or the other, right? If the repo creates FileMeta from the exact metadata bytes it serves, and the client uses exactly those bytes to compute the hash, then no canonicalization is needed. I think this is how the spec pictures it.

Using a canonical form of the full(!) metadata (not only the signed bytes like) would be an alternative, if above is not possible.

Another alternative would be to generate FileMeta without hashes as described in Mercury.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants