[release-12.0.1] Apply security patch 357-202503311017.patch (#104493)

Apply security patch 357-202503311017.patch (#104490)

* Sanitize paths before evaluating access to route

* use util.CleanRelativePath

---------

Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com>
(cherry picked from commit 1f707d16ed)

Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com>
This commit is contained in:
grafana-delivery-bot[bot]
2025-04-24 20:40:18 +01:00
committed by GitHub
parent 8a4a68cf95
commit 26b81feb85
2 changed files with 17 additions and 1 deletions
+9 -1
View File
@@ -300,7 +300,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
}