Skip to content

Remove unsafely_update_root_if_necessary from  #1174

Closed

Description

@MVrachev

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?

as described here: https://groups.google.com/g/theupdateframework/c/kpRPmBo74fk/m/vuy26p39VjAJ

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.

Activity

  1. jku commented on Oct 12, 2020

    @jku
    Member

    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.

  2. added
    clientRelated to the client (updater) implementation
    documentationDocumentation of the project as well as procedural documentation
    on Oct 14, 2020
  3. joshuagl commented on Oct 14, 2020

    @joshuagl
    Member

    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.

  4. jku commented on Nov 30, 2021

    @jku
    Member

    Closing: we are not changing legacy client and ngclient does not have the same design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clientRelated to the client (updater) implementationdocumentationDocumentation of the project as well as procedural documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions