Sanitize paths before evaluating access to route

This commit is contained in:
Andres Martinez Gotor
2025-03-31 12:15:52 +02:00
committed by Kevin Minehart
parent f6036260aa
commit dbfbf82e38
2 changed files with 17 additions and 1 deletions
+9 -1
View File
@@ -299,7 +299,15 @@ func (proxy *DataSourceProxy) validateRequest() error {
}
// route match
if !strings.HasPrefix(proxy.proxyPath, route.Path) {
r1, err := util.CleanRelativePath(proxy.proxyPath)
if err != nil {
return err
}
r2, err := util.CleanRelativePath(route.Path)
if err != nil {
return err
}
if !strings.HasPrefix(r1, r2) {
continue
}