mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 07:33:21 +00:00
Cleanup path before auth check
This commit is contained in:
parent
f8e774393c
commit
723f29e594
1 changed files with 4 additions and 1 deletions
|
@ -167,7 +167,10 @@ func (s *Server) AuthHandler(f *HtpasswdFile, h http.Handler) http.HandlerFunc {
|
||||||
http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
|
http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if s.PrivateRepos && !isUserPath(username, r.URL.Path) && r.URL.Path != "/metrics" {
|
|
||||||
|
// resolve all relative elements in the path
|
||||||
|
urlPath := path.Clean(r.URL.Path)
|
||||||
|
if s.PrivateRepos && !isUserPath(username, urlPath) && urlPath != "/metrics" {
|
||||||
http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
|
http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue