From 557c310c8c0d653c1b78d77df2e3ff0556853637 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Fri, 4 Jun 2021 14:29:23 -0400 Subject: [PATCH] Alerting: Recact html responses (#35277) (#35282) (cherry picked from commit fba90b8f9b9123e3d1371839ad8537c7acfb8e84) Co-authored-by: Sofia Papagiannaki --- pkg/services/ngalert/api/util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/services/ngalert/api/util.go b/pkg/services/ngalert/api/util.go index 188e301f2bf..afddcee0276 100644 --- a/pkg/services/ngalert/api/util.go +++ b/pkg/services/ngalert/api/util.go @@ -118,6 +118,10 @@ func (p *AlertingProxy) withReq( errMessage = message.(string) } } + } else if strings.HasPrefix(resp.Header().Get("Content-Type"), "text/html") { + // if Content-Type is text/html + // do not return the body + errMessage = "redacted html" } return ErrResp(status, errors.New(errMessage), "") }