[x] 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 https://github.com/theupdateframework/go-tuf/pull/384#discussion_r972099602), 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
https://github.com/theupdateframework/go-tuf/pull/384 didn't fix the whole issue it intended to fix, this PR intends to complete it.
Types of changes:
!
, as infeat!: 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 https://github.com/theupdateframework/go-tuf/pull/384#discussion_r972099602), it will fetch target files and verify the whole delegation chain to add delegated targets to thelocalMeta
(as loadLocalMetaFromSnapshot leverages thelocalMeta
). To do so, as thelocalMeta
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 snapshotErrUnknownTarget
is a target file was deletedThis PR ignores these errors as they are part of the normal behaviour of the
localMeta
load algorithm. Note that it doesn't fix https://github.com/theupdateframework/go-tuf/issues/444.Please verify and check that the pull request fulfills the following requirements: