git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #2192 from jawys/fix-use-x-forwarded-uri-for-pathregex-match

fix: use X-Forwarded-Uri if it exists for pathRegex match

commitd9b9bcf9d46522aaf593e59ae34d3ef197fd36a7 authorJoel Speed <Joel.speed@hotmail.co.uk> dateThu 24 Aug 2023, 11:32 (3 years ago) parent7b3a36b2d22530
2 files changed+3−2
CHANGELOG.md+1 oauthproxy.go+2−2
CHANGELOG.md+1
@@ -7,6 +7,7 @@
77## Breaking Changes
88
99## Changes since v7.4.0
10+- [#2133](https://github.com/oauth2-proxy/oauth2-proxy/pull/2133) Use X-Forwarded-Uri if it exists for pathRegex match
1011- [#2028](https://github.com/oauth2-proxy/oauth2-proxy/pull/2028) Update golang.org/x/net to v0.7.0 ato address GHSA-vvpx-j8f3-3w6h
1112- [#1873](https://github.com/oauth2-proxy/oauth2-proxy/pull/1873) Fix empty users with some OIDC providers (@babs)
1213- [#1882](https://github.com/oauth2-proxy/oauth2-proxy/pull/1882) Make `htpasswd.GetUsers` racecondition safe
oauthproxy.go+2−2
@@ -554,7 +554,7 @@ func isAllowedMethod(req *http.Request, route allowedRoute) bool {
554554}
555555
556556func isAllowedPath(req *http.Request, route allowedRoute) bool {
557− matches := route.pathRegex.MatchString(req.URL.Path)
557+ matches := route.pathRegex.MatchString(requestutil.GetRequestURI(req))
558558
559559 if route.negate {
560560 return !matches
@@ -575,7 +575,7 @@ func (p *OAuthProxy) isAllowedRoute(req *http.Request) bool {
575575
576576func (p *OAuthProxy) isAPIPath(req *http.Request) bool {
577577 for _, route := range p.apiRoutes {
578− if route.pathRegex.MatchString(req.URL.Path) {
578+ if route.pathRegex.MatchString(requestutil.GetRequestURI(req)) {
579579 return true
580580 }
581581 }