Team LBAC: Limit access to data source (#78376)

* Team LBAC: Limit access to data source

* Fix tests
This commit is contained in:
Alexander Zobnin
2023-12-05 13:45:40 +02:00
committed by GitHub
parent d099292d99
commit 043096d652
4 changed files with 76 additions and 56 deletions
+4 -1
View File
@@ -376,9 +376,12 @@ func validateTeamHTTPHeaderJSON(jsonData *simplejson.Json) error {
datasourcesLogger.Error("Unable to marshal TeamHTTPHeaders")
return errors.New("validation error, invalid format of TeamHTTPHeaders")
}
if teamHTTPHeadersJSON == nil {
return nil
}
// whitelisting ValidHeaders
// each teams headers
for _, teamheaders := range teamHTTPHeadersJSON {
for _, teamheaders := range teamHTTPHeadersJSON.Headers {
for _, header := range teamheaders {
if !slices.ContainsFunc(validHeaders, func(v string) bool {
return http.CanonicalHeaderKey(v) == http.CanonicalHeaderKey(header.Header)