Azure / Azure/azure-storage-ruby

Can't omit expiry when using Stored Access Policies

Open
#174 0 comments 1 reaction 1 assignee Claimed by @katmsft View on GitHub
enhancement
Dominant language
Ruby
Stars
88
Forks
177
PR merge metrics
No merged PRs in 30d

Description

The gem doesn't handle "must be omitted" very well as it comes to using stored access policies.

https://docs.microsoft.com/en-us/rest/api/storageservices/create-service-sas#specifying-the-access-policy

* permissions, aka `sp`. [This defaults to "r"](https://github.com/Azure/azure-storage-ruby/blob/e5059568b6b971f6981b454fd71cf211429d418e/common/lib/azure/storage/common/core/auth/shared_access_signature_generator.rb#L38), but should not be applied if "identifier" is passed. It can be worked around via passing `permissions: nil`. How often are people defining Storage Access Policies with no permission? That said, it's probably not good to foreclose the more obscure use case, so if it is set, it should be respected.

* expiry, aka `se`. This one less ambiguous: it is okay to pass it if the stored access policy is indefinite, and not okay to pass it if it is also defined in the stored access policy. This gem [forces you to include it](https://github.com/Azure/azure-storage-ruby/blob/e5059568b6b971f6981b454fd71cf211429d418e/common/lib/azure/storage/common/core/auth/shared_access_signature_generator.rb#L334), making Stored Access Policies with expirations unavailable. I removed this line in a local hacked version of the gem, and this got it to work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.