Ensure we never inadvertently whitelist an empty path
I cannot recall whether the Path field is guaranteed to be non-empty on incoming Request values. When in doubt...
This commit is contained in:
parent
c9b7e27f76
commit
c7a9ad814b
4
main.go
4
main.go
|
@ -100,6 +100,10 @@ func checkAuthorizationHeader(handler http.Handler, r *http.Request, w http.Resp
|
|||
}
|
||||
|
||||
func checkWhitelist(handler http.Handler, r *http.Request, w http.ResponseWriter) bool {
|
||||
if config.Whitelist == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
if r.URL.Path == config.Whitelist {
|
||||
handler.ServeHTTP(w, r)
|
||||
return true
|
||||
|
|
Loading…
Reference in New Issue