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

Error in case the delegated role is missing from the snapshot #652

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading