Skip to content

Commit

Permalink
Fix handling the unexpected return value combination from IsRunningIm…
Browse files Browse the repository at this point in the history
…ageAllowed

Signed-off-by: Miloslav Trmač <[email protected]>
  • Loading branch information
mtrmac committed Jul 18, 2023
1 parent c40f148 commit f236b5e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/skopeo/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,11 @@ func (h *proxyHandler) openImageImpl(args []any, allowNotFound bool) (retReplyBu

unparsedTopLevel := image.UnparsedInstance(imgsrc, nil)
allowed, err := policyContext.IsRunningImageAllowed(context.Background(), unparsedTopLevel)
if !allowed || err != nil {
if err != nil {
return ret, err
}
if !allowed && err == nil {
return ret, fmt.Errorf("policy verification failed unexpectedly")
if !allowed {
return ret, fmt.Errorf("internal inconsistency: policy verification failed without returning an error")
}

// Note that we never return zero as an imageid; this code doesn't yet
Expand Down

0 comments on commit f236b5e

Please sign in to comment.