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

fix(localMeta): Ignore deleted delegated targets #522

Conversation

BaptisteFoy
Copy link
Contributor

@BaptisteFoy BaptisteFoy commented Jul 21, 2023

#384 didn't fix the whole issue it intended to fix, this PR intends to complete it.

Types of changes:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please ensure that your PR title is a Conventional Commit breaking change (with a !, as in feat!: change foo).

Description of the changes being introduced by the pull request:

The way #384 works is that, to add delegated targets to the localMeta while verifying them (as requested per #384 (comment)), it will fetch target files and verify the whole delegation chain to add delegated targets to the localMeta (as loadLocalMetaFromSnapshot leverages the localMeta). To do so, as the localMeta is empty and can't be leveraged, we pull delegated targets and target files from the remote store.

The problem is that such files can be deleted in the remote store in the mean time, leading to two errors:

  • ErrMissingRemoteMetadata is the delegated targets file was deleted and removed from the snapshot
  • ErrUnknownTarget is a target file was deleted

This PR ignores these errors as they are part of the normal behaviour of the localMeta load algorithm. Note that it doesn't fix #444.

Please verify and check that the pull request fulfills the following requirements:

  • Tests have been added for the bug fix or new feature
  • Docs have been added for the bug fix or new feature

@BaptisteFoy BaptisteFoy force-pushed the fix/ignore-deleted-delegated-targets-in-localmeta branch 2 times, most recently from 766e2ed to 474e696 Compare July 21, 2023 10:38
@BaptisteFoy BaptisteFoy marked this pull request as ready for review July 21, 2023 13:47
@trishankatdatadog trishankatdatadog force-pushed the fix/ignore-deleted-delegated-targets-in-localmeta branch from caed9d3 to 82e43d3 Compare October 11, 2023 16:18
Copy link
Member

@trishankatdatadog trishankatdatadog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, @BaptisteFoy!

LGTM, although I have to say I'm not happy with the rather convoluted delegations code overall in go-tuf (although hopefully go-tuf-metadata will replace it soon).

@rdimitrov WDYT?

Signed-off-by: Baptiste Foy <baptiste.foy@datadoghq.com>
@rdimitrov rdimitrov force-pushed the fix/ignore-deleted-delegated-targets-in-localmeta branch from 82e43d3 to 6e1d194 Compare October 12, 2023 13:27
@rdimitrov rdimitrov merged commit 58f321a into theupdateframework:master Oct 12, 2023
15 checks passed
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

Successfully merging this pull request may close these issues.

Product targets not in a target file delegation paths are not added to the localMeta
4 participants