mirror of
https://github.com/prometheus/prometheus
synced 2024-12-25 07:52:28 +00: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)
|
||||
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)
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ func (rule *RecordingRule) HTMLSnippet(pathPrefix string) template.HTML {
|
||||
|
||||
byt, err := yaml.Marshal(r)
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user