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
backlogIssues to address with priority for current development goalsdiscussionDiscussions related to the design, implementation and operation of the project
This issue aims to document thoughts about the Threshold attribute from the root and targets roles and more precisely in our implementation Role and DelegatedRole classes.
The goal is to understand how we use that attribute, what might go wrong with it and how we can validate it.
We want to answer/address the following 6 questions/points based on my comment here:
How do we use it?
What might go wrong?
Rethink how we store it?
If, after the changes in step 3 there are concerns, then add a validation function
Make the necessary changes for points 1 - 4, think and propose a way to integrate it into the class/classes (decorators, descriptors, etc.)
create a pr for all additional changes on top of the validation functions
PS: The 7-th point is covered by documenting this issue.
Then after initialization, in MetadataBundle.verify_with_threshold and in pr #1436 we are using threshold as a read-only constant.
once we get to repository-side code, Role and DelegatedRole will be modified though: threshold and keyids do potentially change. Not much thought has been put into this yet (possibly we want more API than add_key()/remove_key())... I think it's fine to implement validation based on current use -- if we don't know what the modifying API looks like we can't really validate that.
once we get to repository-side code, Role and DelegatedRole will be modified though: threshold and keyids do potentially change. Not much thought has been put into this yet (possibly we want more API than add_key()/remove_key())... I think it's fine to implement validation based on current use -- if we don't know what the modifying API looks like we can't really validate that.
One alternative to this is to consider Role and DelegatedRole immutable objects: when repository code wants to change keys or threshold of a role, it should just add/remove/replace the complete role instead of modifying the keys/threshold in the role. This way it would be easier to ensure that e.g. the delegation keys includes the keys (and only the keys) that are actually used by current delegation roles.
Regardless, i don't think this should affect what you do to threshold within the Role object: what you're planning seems fine.
I think mentally I always considered Key as an immutable object.
As you pointed out: because we are not sure what modification API do we want to add we can only verify what we know.
Will submit a pr verifying only the simplest case - that threshold is more than 1.
backlogIssues to address with priority for current development goalsdiscussionDiscussions related to the design, implementation and operation of the project
Activity
MVrachev commentedon Jun 9, 2021
Role.__init__andDelegationRole.__init__(still inDelegationRolewe callRole.__init__for threshold).MetadataBundle.verify_with_thresholdand in pr Metadata API: Implement threshold verification #1436 we are usingthresholdas a read-only constant.Role.__init__because it's called when creating bothRoleandDelegationRole.Would love to hear @jku opion.
jku commentedon Jun 14, 2021
once we get to repository-side code, Role and DelegatedRole will be modified though: threshold and keyids do potentially change. Not much thought has been put into this yet (possibly we want more API than
add_key()/remove_key())... I think it's fine to implement validation based on current use -- if we don't know what the modifying API looks like we can't really validate that.jku commentedon Jun 15, 2021
One alternative to this is to consider Role and DelegatedRole immutable objects: when repository code wants to change keys or threshold of a role, it should just add/remove/replace the complete role instead of modifying the keys/threshold in the role. This way it would be easier to ensure that e.g. the delegation keys includes the keys (and only the keys) that are actually used by current delegation roles.
Regardless, i don't think this should affect what you do to threshold within the Role object: what you're planning seems fine.
MVrachev commentedon Jun 15, 2021
I think mentally I always considered
Keyas an immutable object.As you pointed out: because we are not sure what modification API do we want to add we can only verify what we know.
Will submit a pr verifying only the simplest case - that
thresholdis more than 1.