Azure / azure-storage-cpp

Microsoft Azure Storage Client Library for C++
http://azure.github.io/azure-storage-cpp
Apache License 2.0
131 stars 147 forks source link

'Missing mandatory parameters for valid Shared Access Signature' with an account SAS URI #383

Open tomswedlund opened 3 years ago

tomswedlund commented 3 years ago

Hi there,

I'm an FTE with the CosmosDB team (my alias is toswedlu, I couldn't log into GitHub with it for some reason today) and I'm having an issue with some end-to-end testing for some features we are GA'ing shortly. When using the storage SDK, we previously only used service SAS URIs, but now are using account SAS URIs in addition to. When using the account SAS URIs to access blobs, I'm now seeing the error 'Missing mandatory parameters for valid Shared Access Signature'. I've tracked down the line of code that throws this exception (shared_access_signature.cpp, line 121) and it seems that the "sr" parameter is expected on the SAS token, though this is not a valid parameter for account SAS tokens. Could this be a bug, or does this mean that account SAS tokens are not supported?

We are running short on time considering a looming GA deadline, so any help would be appreciated. I've also run a quick test by appending "&sr=" or "&sr=something" and this seems to resolve the issue, at least in a small SDK test. Could this be an acceptable work around, if this is truly a bug?

Thanks!, Tom

Jinming-Hu commented 3 years ago

Hi @tomswedlund , thanks for reporting this issue. You’re right, sr should not be mandatory for account SAS. I believe this is a bug. And I think your workaround is fine. I don’t think your fix will bring other issues.