mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix scopes mutation by cloning original array (#37981)
This commit is contained in:
parent
050dc7bc8f
commit
c6356c5bba
@ -140,6 +140,12 @@ func (c *managedIdentityTokenRetriever) Init() error {
|
||||
}
|
||||
|
||||
func (c *managedIdentityTokenRetriever) GetAccessToken(ctx context.Context, scopes []string) (*AccessToken, error) {
|
||||
// Workaround for a bug in Azure SDK which mutates the passed array of scopes
|
||||
// See details https://github.com/Azure/azure-sdk-for-go/issues/15308
|
||||
arr := make([]string, len(scopes))
|
||||
copy(arr, scopes)
|
||||
scopes = arr
|
||||
|
||||
accessToken, err := c.credential.GetToken(ctx, azcore.TokenRequestOptions{Scopes: scopes})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user