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
{{ message }}
Repository navigation
Remove unsafely_update_root_if_necessary from #1174
Description of issue or feature request:
The updater workflow has been changed.
Before the order was timestamp -> snapshot -> root -> targets
Because of that, there was a potential problem when you have an outdated client:
An outdated client has an old 'root.txt' file that lists revoked keys for both the Timestamp and Release roles. When this client polls for an update, he is unable to update these two files (i.e., their signatures are rejected). At this point he can only verify that the root has been correctly signed [1] and that a newer 'root.txt' may be available that contains the valid keys for the other top-level roles. Should we have code in place to allow outdated clients to update in this case?
Now, the thinks are changed and the order is: root (if necessary) -> timestamp -> snapshot -> targets
In my humble opinion, the above situation is not possible, right?
If that's the case we can remove the additional unsafely_update_root_if_necessaryarg arg from tuf/client/updater.py refresh function.
Current behavior: unsafely_update_root_if_necessaryarg is used and it's true by default.
Expected behavior:
Remove unsafely_update_root_if_necessaryarg as a whole.
I think the argument is useful: it just does something different from the name or the documentation.
except tuf.exceptions.ExpiredMetadataError:
# Raise 'tuf.exceptions.NoWorkingMirrorError' if a valid (not
# expired, properly signed, and valid metadata) 'root.json' cannot be
# installed.
if unsafely_update_root_if_necessary:
logger.info('Expired Root metadata was loaded from disk.'
' Try to update it now.' )
# The caller explicitly requested not to unsafely fetch an expired Root.
else:
logger.info('An expired Root metadata was loaded and must be updated.')
raise
Even the comment is confused but the code seems reasonable to me: by default (arg is True) continue to update metadata even if local root metadata has expired. But if caller explicitly set arg to False, fail on expired local root metadata.
This seems like a valid feature to have: some clients may well want to fail on expiry. It's just that the name, the comments and the documentation seem to be wrong.
Removing the argument or modifying the argument name is a breaking change.
Jussi's understanding matches my own, we need this argument during refresh to update from a potentially expired trusted (or bootstrap) root metadata to the latest root metadata.
That it is confusing indicated we absolutely should fix the documentation. However, I don't think we should change the name at this time as we can't do so without potentially breaking users.
We can consider changing the name in a future breaking update such as the proposed refactor.
Activity
jku commentedon Oct 12, 2020
I think the argument is useful: it just does something different from the name or the documentation.
Even the comment is confused but the code seems reasonable to me: by default (arg is True) continue to update metadata even if local root metadata has expired. But if caller explicitly set arg to False, fail on expired local root metadata.
This seems like a valid feature to have: some clients may well want to fail on expiry. It's just that the name, the comments and the documentation seem to be wrong.
Removing the argument or modifying the argument name is a breaking change.
joshuagl commentedon Oct 14, 2020
Thank you for taking the time to report this.
Jussi's understanding matches my own, we need this argument during refresh to update from a potentially expired trusted (or bootstrap) root metadata to the latest root metadata.
That it is confusing indicated we absolutely should fix the documentation. However, I don't think we should change the name at this time as we can't do so without potentially breaking users.
We can consider changing the name in a future breaking update such as the proposed refactor.
jku commentedon Nov 30, 2021
Closing: we are not changing legacy client and ngclient does not have the same design.