mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AuthZ: add headers for IP range AC checks for data source proxy requests (#81662)
* add a middleware that appens headers for IP range AC to data source proxy requests * update code * add tests * fix a mistake * add logging * refactor to reuse code * small cleanup * skip the plugins middleware if the header is already set * skip the plugins middleware if the header is already set
This commit is contained in:
@@ -1944,6 +1944,9 @@ func (cfg *Cfg) readDataSourceSecuritySettings() {
|
||||
datasources := cfg.Raw.Section("datasources.ip_range_security")
|
||||
cfg.IPRangeACEnabled = datasources.Key("enabled").MustBool(false)
|
||||
cfg.IPRangeACSecretKey = datasources.Key("secret_key").MustString("")
|
||||
if cfg.IPRangeACEnabled && cfg.IPRangeACSecretKey == "" {
|
||||
cfg.Logger.Error("IP range access control is enabled but no secret key is set")
|
||||
}
|
||||
allowedURLString := datasources.Key("allow_list").MustString("")
|
||||
for _, urlString := range util.SplitString(allowedURLString) {
|
||||
allowedURL, err := url.Parse(urlString)
|
||||
|
||||
Reference in New Issue
Block a user