fix(influxdb): enforce database restriction, fixes #6352

This commit is contained in:
Torkel Ödegaard 2016-10-22 10:03:02 +02:00
parent 401c67d136
commit b32bbbd1a2

View File

@ -95,6 +95,13 @@ func ProxyDataSourceRequest(c *middleware.Context) {
return
}
if ds.Type == m.DS_INFLUXDB {
if c.Query("db") != ds.Database {
c.JsonApiErr(403, "Datasource is not configured to allow this database", nil)
return
}
}
targetUrl, _ := url.Parse(ds.Url)
if len(setting.DataProxyWhiteList) > 0 {
if _, exists := setting.DataProxyWhiteList[targetUrl.Host]; !exists {