You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We made Role.keyids a set because the keyids are supposed to be unique -- this still makes sense
However, the data should also preserve order (when deserialized and serialized) and currently it does not. This is fairly serious since writing signed data potentially modifies the data (making the signature invalid).
We should have tests that deserialize/serialize metadata with more than one item in each container (like roles keyids) to notice issues like this -- this should be easy now that the serialization tests exist
We should fix the issue with Role.keyids -- my assumption is that the issue is Set not being ordered but I'm not 100% on that
Good catch. I wonder if there are multiple valid ways to get the same set
from serialized data. I'm not sure yet what all attacks this could enable,
but it is worth thinking about.
@marina Moore ***@***.***>
On Fri, Jul 2, 2021 at 9:16 PM Jussi Kukkonen ***@***.***> wrote:
We made Role.keyids a set because the keyids are supposed to be unique --
this still makes sense
However, the data should also preserve order (when deserialized and
serialized) and currently it does not. This is fairly serious since writing
signed data potentially modifies the data (making the signature invalid).
- We should have tests that sign and verify metadata with more than
one item in each container (like roles keyids) to notice issues like this
- We should fix the issue with Role.keyids -- my assumption is that
the issue is Set not being ordered but I'm not 100% on that
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1478>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGRODYUOSNRXYEYFDJSVPDTVW33VANCNFSM47WWV76A>
.
I'm sure sorted() is reliable in its sort but the return value is not a set (it's a list) -- so we won't get the benefits we were hoping for by using a set (namely the API safety in that adding non-unique keyids would be very difficult).
Edit: or maybe you mean we could use set but always serialize using sorted? That might work...
Activity
JustinCappos commentedon Jul 3, 2021
jku commentedon Jul 5, 2021
The serialization test case is indeed easy: this fails
test_role_serialization()almost always:So I think the easiest solution is:
_keyids: List[str]and add a public propertykeyids: List[str](with getter/setter)sechkova commentedon Jul 6, 2021
Here is the commit making signatures deterministic by sorting the set of signing keys in case this may help: 846604a
But in this case keys would have to be the same sorted set on serialization and deserialization so it may not be the best solution.
jku commentedon Jul 6, 2021
I'm sure sorted() is reliable in its sort but the return value is not a set (it's a list) -- so we won't get the benefits we were hoping for by using a set (namely the API safety in that adding non-unique keyids would be very difficult).
Edit: or maybe you mean we could use set but always serialize using sorted? That might work...