-
Notifications
You must be signed in to change notification settings - Fork 275
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
Metadata API validation: validate root roles dictionary content #1516
Comments
These seem to be the steps:
Additionally:
|
I guess this is a good time to think if the Root constructor signature makes sense: This would make Constructing Root from scratch a little easier, and
|
Maybe then we should add additional validation that Also about what you said above:
If we leave it as it is and don't check that root contains exactly 4 roles with the correct naming, then I don't see what do we have to update in that dataset. |
Are you now talking about my off the cuff idea of changing the constructor or the current situation? Whenever we take a dictionary as input we should validate that the four correct keys are there -- A Root object without exactly four correct roles is invalid and shouldn't never exist IMO. So as a minimum we need to do it on Now, I would like to make the constructors easier to use for the repository use case but there is no concrete proposal so I don't think you should worry about that too much in this issues. Anyway, possibly we can avoid big API changes (like the one I proposed above) and e.g. just accept |
I wanted to raise discussion for all of the topics you mentioned.
Agree. Validation for this should be added as well and this will require changing the
I agree with this, but I am not sure about this part:
you don't suggest doing that API change in this issue right? |
I don't: only reason to discuss these here is just in case they would make the validation obsolete... That doesn't seem likely so let's just forget it for now. |
Okay, then I can fix this issue because it's connected with another one I am already involved in #1356. |
Spec says this about root roles:
The reference to "key list" seems like a mistake (maybe referring to an earlier design?) but the intent seems clear: the roles dictionary is allowed to contain either the roles for
["root", "snapshot", "timestamp", "targets"]
or the roles for["root", "snapshot", "timestamp", "targets", "mirror"]
(and I suppose we are not going to implement mirror for now)). Other roles are not valid and not having the first four roles is not valid.It makes sense to validate this in Root construction/deserialization.
Aside/thought: maybe it also makes sense to validate in serialization but I think documenting that roles dict is not intended to be modified goes a long way.
The text was updated successfully, but these errors were encountered: