Skip to content

Commit

Permalink
fix xss vulnerability (grafana#10559)
Browse files Browse the repository at this point in the history
**What this PR does / why we need it**:
XSS vulnerability of fmt.Sprintf. fmt.Sprintf would reflect part of the
input in the output without escaping, which causes XSS.
  • Loading branch information
HandyDaddy authored Sep 13, 2023
1 parent 5f7bde7 commit 216fb75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sizing/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (h *Handler) Nodes(w http.ResponseWriter, _ *http.Request) {

func (h *Handler) respondError(w http.ResponseWriter, err error) {
w.WriteHeader(http.StatusBadRequest)
_, err = w.Write([]byte(fmt.Sprintf("error: %v", err)))
_, err = w.Write([]byte(fmt.Sprintf("error: %q", err)))
if err != nil {
level.Error(h.logger).Log("msg", "could not write error message", "error", err)
}
Expand Down

0 comments on commit 216fb75

Please sign in to comment.