Fix deleting prom rules endpoints via ds_proxy (#33491)

This commit is contained in:
Sofia Papagiannaki 2021-04-29 10:20:51 +03:00 committed by GitHub
parent e977085933
commit fcd674ec58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -290,6 +290,9 @@ func (proxy *DataSourceProxy) validateRequest() error {
if proxy.ctx.Req.Request.Method == "PUT" { if proxy.ctx.Req.Request.Method == "PUT" {
return errors.New("non allow-listed PUTs not allowed on proxied Prometheus datasource") return errors.New("non allow-listed PUTs not allowed on proxied Prometheus datasource")
} }
if proxy.ctx.Req.Request.Method == "POST" {
return errors.New("non allow-listed POSTs not allowed on proxied Prometheus datasource")
}
} }
return nil return nil

View File

@ -31,17 +31,17 @@
}, },
{ {
"method": "GET", "method": "GET",
"path": "api/v1/rules", "path": "/rules",
"reqRole": "Viewer" "reqRole": "Viewer"
}, },
{ {
"method": "POST", "method": "POST",
"path": "api/v1/rules", "path": "/rules",
"reqRole": "Editor" "reqRole": "Editor"
}, },
{ {
"method": "DELETE", "method": "DELETE",
"path": "api/v1/rules", "path": "/rules",
"reqRole": "Editor" "reqRole": "Editor"
} }
], ],