mirror of
https://github.com/goharbor/harbor
synced 2025-04-22 19:10:40 +00:00
block pull scan failed image (#3119)
This commit is contained in:
parent
8f34945d4b
commit
97f73dbf6c
@ -281,9 +281,10 @@ func (vh vulnerableHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
|
|||||||
http.Error(rw, marshalError("Failed to get ImgScanOverview.", http.StatusPreconditionFailed), http.StatusPreconditionFailed)
|
http.Error(rw, marshalError("Failed to get ImgScanOverview.", http.StatusPreconditionFailed), http.StatusPreconditionFailed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if overview == nil {
|
// severity is 0 means that the image fails to scan or not scanned successfully.
|
||||||
|
if overview == nil || overview.Sev == 0 {
|
||||||
log.Debugf("cannot get the image scan overview info, failing the response.")
|
log.Debugf("cannot get the image scan overview info, failing the response.")
|
||||||
http.Error(rw, marshalError("Cannot get the image scan overview info.", http.StatusPreconditionFailed), http.StatusPreconditionFailed)
|
http.Error(rw, marshalError("Cannot get the image severity.", http.StatusPreconditionFailed), http.StatusPreconditionFailed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
imageSev := overview.Sev
|
imageSev := overview.Sev
|
||||||
|
Loading…
x
Reference in New Issue
Block a user