mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-04 05:51:22 +01:00
Merge pull request #2474 from reasonerjt/comment-in-proxy
fix typo and refine message in content trust interceptor
This commit is contained in:
commit
e54be8862d
@ -60,6 +60,7 @@ func (ec envPolicyChecker) contentTrustEnabled(name string) bool {
|
||||
return os.Getenv("PROJECT_CONTENT_TRUST") == "1"
|
||||
}
|
||||
func (ec envPolicyChecker) vulnerableEnabled(name string) bool {
|
||||
// TODO: May need get more information in vulnerable policies.
|
||||
return os.Getenv("PROJECT_VULNERABBLE") == "1"
|
||||
}
|
||||
|
||||
@ -161,8 +162,8 @@ func (cth contentTrustHandler) ServeHTTP(rw http.ResponseWriter, req *http.Reque
|
||||
log.Debugf("Passing the response to outter responseWriter")
|
||||
copyResp(rec, rw)
|
||||
} else {
|
||||
log.Debugf("digest miamatch, failing the response.")
|
||||
http.Error(rw, "Failure in content trust handler", http.StatusPreconditionFailed)
|
||||
log.Debugf("digest mismatch, failing the response.")
|
||||
http.Error(rw, "The image is not signed in Notary.", http.StatusPreconditionFailed)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ func Init(urls ...string) error {
|
||||
return err
|
||||
}
|
||||
Proxy = httputil.NewSingleHostReverseProxy(targetURL)
|
||||
//TODO: add vulnerable interceptor.
|
||||
handlers = handlerChain{head: urlHandler{next: contentTrustHandler{next: Proxy}}}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user