API: Do not expose user input in datasource error responses (#52992) (#52996)

(cherry picked from commit 87004cc22d)

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2022-07-29 16:18:53 +03:00
committed by GitHub
co-authored by Sofia Papagiannaki
parent 44bdccbfd1
commit 457c110b26
+2 -1
View File
@@ -235,7 +235,8 @@ func (hs *HTTPServer) DeleteDataSourceByName(c *models.ReqContext) response.Resp
func validateURL(cmdType string, url string) response.Response {
if _, err := datasource.ValidateURL(cmdType, url); err != nil {
return response.Error(400, fmt.Sprintf("Validation error, invalid URL: %q", url), err)
datasourcesLogger.Error("Failed to validate URL", "url", url)
return response.Error(http.StatusBadRequest, "Validation error, invalid URL", err)
}
return nil