Chore: Remove public vars in setting package (#81018)
Removes the public variable setting.SecretKey plus some other ones. Introduces some new functions for creating setting.Cfg.
This commit is contained in:
@@ -275,7 +275,7 @@ func (proxy *DataSourceProxy) director(req *http.Request) {
|
||||
}
|
||||
|
||||
func (proxy *DataSourceProxy) validateRequest() error {
|
||||
if !checkWhiteList(proxy.ctx, proxy.targetUrl.Host) {
|
||||
if !proxy.checkWhiteList() {
|
||||
return errors.New("target URL is not a valid target")
|
||||
}
|
||||
|
||||
@@ -354,10 +354,10 @@ func (proxy *DataSourceProxy) logRequest() {
|
||||
"body", body)
|
||||
}
|
||||
|
||||
func checkWhiteList(c *contextmodel.ReqContext, host string) bool {
|
||||
if host != "" && len(setting.DataProxyWhiteList) > 0 {
|
||||
if _, exists := setting.DataProxyWhiteList[host]; !exists {
|
||||
c.JsonApiErr(403, "Data proxy hostname and ip are not included in whitelist", nil)
|
||||
func (proxy *DataSourceProxy) checkWhiteList() bool {
|
||||
if proxy.targetUrl.Host != "" && len(proxy.cfg.DataProxyWhiteList) > 0 {
|
||||
if _, exists := proxy.cfg.DataProxyWhiteList[proxy.targetUrl.Host]; !exists {
|
||||
proxy.ctx.JsonApiErr(403, "Data proxy hostname and ip are not included in whitelist", nil)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user