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

repository_tool incorrectly prevents distinct delegations to same role #589

Closed
awwad opened this issue Jan 16, 2018 · 1 comment
Closed

Comments

@awwad
Copy link
Contributor

awwad commented Jan 16, 2018

The repository tool's delegate function will currently mistakenly prevent you from delegating to the same role from two different roles. Such delegations are expected to be allowed per prior conversation, not forbidden in the spec, and -- except for the error raised below -- seem to be supported by the code.

Simple scenario:
A delegates to C, with some delegation settings (path, keys expected, threshold, termination, etc)
B delegates to C, with possibly different delegation settings

The check raising this error is likely a holdover from the days when role and delegation were more or less synonymous and roles existed in a tree instead of a more general graph.

Current behavior

>>> role_a.delegate('role_c', [dk1_pub, dk2_pub, dk3_pub], ["a*"], threshold=2)
>>> role_b.delegate('role_c', [dk1_pub, dk2_pub], ["b*"], threshold=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/s/w/tuf_clean/tuf/repository_tool.py", line 2227, in delegate
    raise securesystemslib.exceptions.Error(repr(rolename) + ' already'
securesystemslib.exceptions.Error: 'role_c' already delegated.

Expected behavior

No error should be raised; the second delegation to the same role functions independently.

>>> role_a.delegate('role_c', [dk1_pub, dk2_pub, dk3_pub], ["a*"], threshold=2)
>>> role_b.delegate('role_c', [dk1_pub, dk2_pub], ["b*"], threshold=1)
Adding a verification key that has already been used.
Adding a verification key that has already been used.
Adding a verification key that has already been used.

Fix

This is easily solved by removing the lines that raise the error. It should be verified that no damage is done, however (i.e. that the code does support this edge case correctly) so testing this will take a bit of effort and require updater testing.

awwad added a commit to awwad/tuf that referenced this issue Jan 16, 2018
Removes an incorrect check that prevents delegating to a role (X)
if any role has previously delegated to that role (X).

See theupdateframework#589 for more details.
awwad added a commit to awwad/tuf that referenced this issue Jan 16, 2018
Removes an incorrect check that prevents delegating to a role (X)
if any role has previously delegated to that role (X).

See theupdateframework#589 for more details.
awwad added a commit to awwad/tuf that referenced this issue Jan 16, 2018
Removes an incorrect check that prevents delegating to a role (X)
if any role has previously delegated to that role (X).

See theupdateframework#589 for more details.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
awwad added a commit to awwad/tuf that referenced this issue Jan 23, 2018
Removes an incorrect check that prevents delegating to a role (X)
if any role has previously delegated to that role (X).

See theupdateframework#589 for more details.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
@joshuagl joshuagl added this to the Refactor milestone Jul 7, 2020
@joshuagl joshuagl removed this from the Refactor milestone Sep 8, 2020
@jku
Copy link
Member

jku commented Feb 22, 2022

This is no longer an issue in the current implementation.

@jku jku closed this as completed Feb 22, 2022
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