Skip to content

Commit

Permalink
add validations on response from /subscriptions API in ACR (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
vistaarjuneja authored Jan 10, 2024
1 parent 5df1d55 commit 65cd388
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/kaniko-acr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,15 @@ func getPublicUrl(token, registryUrl, subscriptionId string) (string, error) {
if err != nil {
return "", errors.Wrap(err, "failed to send request for getting container registry setting")
}

if len(response.Value) == 0 {
return "", errors.New("did not receive any registry information from /subscriptions API")
}

if response.Value[0].ID == "" {
return "", errors.New("received empty registry ID from /subscriptions API")
}

return finalUrl + encodeParam(response.Value[0].ID), nil
}

Expand Down

0 comments on commit 65cd388

Please sign in to comment.