Middleware: Fix IPv6 host parsing in CSRF check (#45911)

- Also create tests for this middleware

Co-authored-by: Kyle Brandt <kyle@grafana.com>
This commit is contained in:
ying-jeanne
2022-02-28 13:58:56 -05:00
committed by GitHub
co-authored by Kyle Brandt
parent e814e7364b
commit 06ed5efdf0
3 changed files with 140 additions and 5 deletions
+1 -1
View File
@@ -467,7 +467,7 @@ func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
}
m.Use(middleware.Recovery(hs.Cfg))
m.UseMiddleware(middleware.CSRF(hs.Cfg.LoginCookieName))
m.UseMiddleware(middleware.CSRF(hs.Cfg.LoginCookieName, hs.log))
hs.mapStatic(m, hs.Cfg.StaticRootPath, "build", "public/build")
hs.mapStatic(m, hs.Cfg.StaticRootPath, "", "public", "/public/views/swagger.html")