-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auth/storage: support for the SharedKey implementation used by the Storage Accounts Data Plane API #512
Conversation
Worth saying this ends up fixing the associated test on our end:
|
* v0.9.0 of github.com/tombuildsstuff/giovanni * a fork of github.com/Azure/go-autorest including Azure/go-autorest#512
This PR supersedes #6049 as nested go modules and merge conflicts do not spark joy - but fundamentally this: - updates github.com/Azure/azure-sdk-for-go to v40.3.0 - updates github.com/Azure/go-autorest to our fork containing Azure/go-autorest#512 - updates github.com/terraform-providers/terraform-provider-azuread to v0.8.0 - code changes needed for v40.3.0 of the Azure SDK - including opting into the old count 429's as requests which should be retried without adding to the total failure count Enables #5769 Enables #5696
ping @jhendrixMSFT :) |
Sorry for the delay. I think this is a bug in the string-to-sign implementation. We shouldn't have to special-case this based on the root, just if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also update version.go and CHANGELOG please.
autorest/authorization_storage.go
Outdated
@@ -35,6 +35,9 @@ const ( | |||
// SharedKey is used to authorize against blobs, files and queues services. | |||
SharedKey SharedKeyType = "sharedKey" | |||
|
|||
// SharedKey is used to authorize against the account. | |||
SharedKeyForAccount SharedKeyType = "sharedKeyAccount" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be removed, just add content length in the string-to-sign input if it's not equal to zero.
In an ideal world this wouldn't be necessary, but I digress. Unfortunately it appears that the Accounts Data Plane API uses a different method to calculate the shared key authorization verses other (blob etc) operations which support this auth method. This commit introduces support for a "from account" type which includes support for this auth token, so that this authorizer can be used for those endpoints.
271f873
to
b7b9c7b
Compare
Ensure path is never empty when building canonicalilzed resource.
7d49390
to
503c8e7
Compare
@tombuildsstuff terribly sorry for the delay on this. I dug into it further, the canonicalized resource requires that the root path is never empty. I adapted the fix from azure-storage-blob-go. It's handled slightly different in the legacy storage package but the end result is the same. I've verified with |
Well this is a fun one.
After a bunch of debugging it turns out API's in the root of a Storage Data Plane API use a slightly different, undocumented implementation of SharedKey authorization. Specifically this API and this API - but presumably the others in the root too.
Whilst this is unfortunate - attempting to update this API to match the definition at this point in time would be a breaking change and thus is a less ideal solution.
Instead this PR introduces a new mode to the SharedKey Authorizer which supports the varied authorization method used by this endpoint.
Before this PR, when attempting to hit the Account Endpoint using a SharedKey or SharedKeyLite authorizer with this Request using the SharedKey authorizer:
returns the following Response..
With these changes, and this new Authorizer - the following Request:
.. returns the following Response: