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

WIP: Remove the need of manually marking roles as dirty #1038

Closed
wants to merge 10 commits into from

Commits on May 27, 2020

  1. Mark correctly roles as dirty in repository_tool.py

    Add mark_role_as_dirty parameter to (un)load_signing_key()
    which is False by default since the functions have
    mainly the goal to load metadata from the filesystem.
    
    Add mark_role_as_dirty parameter to remove_signature()
    to match its corresponding add_signature().
    
    Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
    sechkova committed May 27, 2020
    Configuration menu
    Copy the full SHA
    2f83b6b View commit details
    Browse the repository at this point in the history
  2. Add mark_role_as_dirty parameter to add_role()

    Add a boolean parameter to give the flexibility to repository
    tools to mark newly added roles as dirty depending on being
    created or loaded from disk.
    
    Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
    sechkova committed May 27, 2020
    Configuration menu
    Copy the full SHA
    6411de8 View commit details
    Browse the repository at this point in the history
  3. Update tests calling add_role()

    Update accordingly the tests for the new parameter of add_role().
    
    Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
    sechkova committed May 27, 2020
    Configuration menu
    Copy the full SHA
    b9b95f1 View commit details
    Browse the repository at this point in the history
  4. Remove unnecessary globals in roledb.py

    Remove unnecessary global declarations of variables which are not
    assigned a value inside the functions (or not referenced at all).
    
    Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
    sechkova committed May 27, 2020
    Configuration menu
    Copy the full SHA
    ac9ab6a View commit details
    Browse the repository at this point in the history
  5. Add mark_role_as_dirty parameter to Targets class

    Add a boolean parameter to the Targets class constructor so that
    when a new delegation object is created, the new rolename is
    correctly marked as dirty in roledb .
    
    By default Targets objects are added to roledb with empty roleinfo
    and are marked as dirty later on "update" but this is not the case
    for delegations.
    
    Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
    sechkova committed May 27, 2020
    Configuration menu
    Copy the full SHA
    4d86eed View commit details
    Browse the repository at this point in the history
  6. Propagate dirty roles in roledb

    Recursively mark as dirty all roles affected by the roledb update
    of a given role e.g.:
      'targets' -> 'snapshot' -> 'timestamp'
    and in case of a key update:
      'targets' -> 'root'
    
    Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
    sechkova committed May 27, 2020
    Configuration menu
    Copy the full SHA
    93968f2 View commit details
    Browse the repository at this point in the history
  7. Add 'delegating_role' to role metadata

    Add a new field in internal role metadata for storing the delegating
    role. This is needed since all updates on roledb are performed on
    the delegated role which has no knowledge about its 'delegator'.
    
    When a delegated role is marked as dirty the 'delegating_role'
    information is used to trigger an update chain.
    
    Update the load_repository() function to load the delegations
    metadata starting from 'targets' in order to get the 'delegating_role'.
    
    Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
    sechkova committed May 27, 2020
    Configuration menu
    Copy the full SHA
    3fb09c2 View commit details
    Browse the repository at this point in the history
  8. Update _log_status_of_top_level_roles

    Update _log_status_of_top_level_roles() function to accommodate
    for the inter-dependencies triggered when marking a role dirty.
    
    Do some basic clean up to avoid code repetition.
    
    Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
    sechkova committed May 27, 2020
    Configuration menu
    Copy the full SHA
    0410847 View commit details
    Browse the repository at this point in the history
  9. Add TOP_LEVEL_ROLES as a global variable

    Add TOP_LEVEL_ROLES as a global variable in roledb.
    
    Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
    sechkova committed May 27, 2020
    Configuration menu
    Copy the full SHA
    7100dc3 View commit details
    Browse the repository at this point in the history
  10. Update tests

    Update tests with the new logic for marking roles dirty
    
    Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
    sechkova committed May 27, 2020
    Configuration menu
    Copy the full SHA
    1a6fb34 View commit details
    Browse the repository at this point in the history