Skip to content

Commit

Permalink
Error in case the delegated role is missing from the snapshot (#652)
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslav Dimitrov <[email protected]>
  • Loading branch information
rdimitrov authored Oct 1, 2024
1 parent 6c47391 commit 4eb06c8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions metadata/updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,11 @@ func (update *Updater) loadTargets(roleName, parentName string) (*metadata.Metad
if update.trusted.Snapshot == nil {
return nil, fmt.Errorf("trusted snapshot not set")
}
// extract the targets meta from the trusted snapshot metadata
metaInfo := update.trusted.Snapshot.Signed.Meta[fmt.Sprintf("%s.json", roleName)]
// extract the targets' meta from the trusted snapshot metadata
metaInfo, ok := update.trusted.Snapshot.Signed.Meta[fmt.Sprintf("%s.json", roleName)]
if !ok {
return nil, fmt.Errorf("role %s not found in snapshot", roleName)
}
// extract the length of the target metadata to be downloaded
length := metaInfo.Length
if length == 0 {
Expand Down

0 comments on commit 4eb06c8

Please sign in to comment.