mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 21:17:58 +08:00
Fix metrics authorization middleware bleed (#3183)
fix: metrics authorization middleware bleed (#3182) Fixes `extension_metrics_disabled.go` to correctly isolate the authz middleware when the metrics extension is disabled. Signed-off-by: Matthieu Mottet <m.mottet@outlook.com>
This commit is contained in:
@@ -29,7 +29,8 @@ func SetupMetricsRoutes(conf *config.Config, router *mux.Router,
|
||||
zcommon.WriteJSON(w, http.StatusOK, m)
|
||||
}
|
||||
|
||||
router.Use(authnFunc)
|
||||
router.Use(authzFunc)
|
||||
router.HandleFunc("/metrics", getMetrics).Methods("GET")
|
||||
extRouter := router.PathPrefix("/metrics").Subrouter()
|
||||
extRouter.Use(authnFunc)
|
||||
extRouter.Use(authzFunc)
|
||||
extRouter.Methods("GET").Handler(http.HandlerFunc(getMetrics))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user