mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 13:57:36 -08:00
rules: HTML-escape rule YAML marshal errors (#4464)
This was pointed out by `gosec`. Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
parent
73a08f0045
commit
2b8fc062a8
|
@ -433,7 +433,7 @@ func (r *AlertingRule) HTMLSnippet(pathPrefix string) html_template.HTML {
|
||||||
|
|
||||||
byt, err := yaml.Marshal(ar)
|
byt, err := yaml.Marshal(ar)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return html_template.HTML(fmt.Sprintf("error marshalling alerting rule: %q", err.Error()))
|
return html_template.HTML(fmt.Sprintf("error marshalling alerting rule: %q", html_template.HTMLEscapeString(err.Error())))
|
||||||
}
|
}
|
||||||
return html_template.HTML(byt)
|
return html_template.HTML(byt)
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ func (rule *RecordingRule) HTMLSnippet(pathPrefix string) template.HTML {
|
||||||
|
|
||||||
byt, err := yaml.Marshal(r)
|
byt, err := yaml.Marshal(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return template.HTML(fmt.Sprintf("error marshalling recording rule: %q", err.Error()))
|
return template.HTML(fmt.Sprintf("error marshalling recording rule: %q", template.HTMLEscapeString(err.Error())))
|
||||||
}
|
}
|
||||||
|
|
||||||
return template.HTML(byt)
|
return template.HTML(byt)
|
||||||
|
|
Loading…
Reference in a new issue