Merge commit from fork

Signed-off-by: Jan Larwig <jan@larwig.com>
This commit is contained in:
Jan Larwig
2026-10-01 09:30:09 +02:00
committed by GitHub
parent 6c6ca0c87d
commit 260c6deca3
7 changed files with 464 additions and 37 deletions
+11 -3
View File
@@ -595,8 +595,8 @@ func isAllowedMethod(req *http.Request, route allowedRoute) bool {
return route.method == "" || req.Method == route.method
}
func isAllowedPath(req *http.Request, route allowedRoute) bool {
matches := route.pathRegex.MatchString(requestutil.GetRequestPath(req))
func isAllowedPath(requestPath string, route allowedRoute) bool {
matches := route.pathRegex.MatchString(requestPath)
if route.negate {
return !matches
@@ -607,8 +607,16 @@ func isAllowedPath(req *http.Request, route allowedRoute) bool {
// IsAllowedRoute is used to check if the request method & path is allowed without auth
func (p *OAuthProxy) isAllowedRoute(req *http.Request) bool {
if len(p.allowedRoutes) == 0 {
return false
}
requestPath, err := requestutil.GetRequestPath(req)
if err != nil {
logger.Errorf("Skipping path-based authentication exemption: %v", err)
return false
}
for _, route := range p.allowedRoutes {
if isAllowedMethod(req, route) && isAllowedPath(req, route) {
if isAllowedMethod(req, route) && isAllowedPath(requestPath, route) {
return true
}
}