You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case of custom parameter usage under Grafana, "Explore" request use directly in request the query param label provided, Hacking the request become possible in that case.
Allowing the Label value passing through http header is not impact by this hack.
Suggestion: X-Prom-Label-<label name> : xxxx
func (r*routes) enforceLabel(h http.HandlerFunc) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, req*http.Request) {
+lvalue:=req.Header.Get("X-Prom-Label-"+r.label)
+iflvalue=="" {
+lvalue=req.URL.Query().Get(r.label)
+ }
iflvalue=="" {
+http.Error(w, fmt.Sprintf("Bad request. The %q query parameter or X-Prom-Label-%q header must be provided.", r.label, r.label), http.StatusBadRequest)
return
}
req=req.WithContext(withLabelValue(req.Context(), lvalue))
The text was updated successfully, but these errors were encountered:
func (r*routes) enforceLabel(h http.HandlerFunc) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, req*http.Request) {
normalizedLabel:=strings.Replace(r.label, "_", "-", -1)
lvalue:=req.Header.Get("X-Prom-Label-"+normalizedLabel)
iflvalue=="" {
lvalue=req.URL.Query().Get(r.label)
}
iflvalue=="" {
http.Error(w, fmt.Sprintf("Bad request. The %q query parameter or \"X-Prom-Label-%s\" header must be provided.", r.label, r.label), http.StatusBadRequest)
return
}
and under grafana datasource definition the header should contains "-" instead of "_" if the label contains such info
ex for app_kubernetes_io_name --> X-Prom-Label-app-kubernetes-io-name
In case of custom parameter usage under Grafana, "Explore" request use directly in request the query param label provided, Hacking the request become possible in that case.
Allowing the Label value passing through http header is not impact by this hack.
Suggestion:
X-Prom-Label-<label name> : xxxx
The text was updated successfully, but these errors were encountered: