Skip to content

[BUG] SAS Signature fields not well formed #6844

Description

@kirankbs

Describe the bug
BLOB resource is uploaded.
Appending SAS query parameters generated by library to BLOB URL causes the request to fail.

Exception or Stack Trace

AuthenticationFailed

Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:485024e3-301e-0001-07c3-b151e6000000 Time:2019-12-13T14:42:24.2855114Z

Signature fields not well formed.

To Reproduce
Using generated SAS token causes intermittent failures.

  1. generate SAS query parameters.
  2. append to blob url
  3. Try to access the resource with the signed url.

Code Snippet
library dependency: "com.azure" % "azure-storage-blob" % "12.1.0"

  1. Generate SAS quary params:
    new BlobServiceSasSignatureValues()
    .setExpiryTime(now().plusDays(conf.urlExpirationDays).toOffsetDateTime)
    .setPermissions(new BlobSasPermission().setReadPermission(true))
    .setContainerName(conf.container)
    .setBlobName(key)
    .generateSasQueryParameters(userDelegationKey(conf.urlExpirationDays), conf.storageAccount)
    .encode()
  2. upload resource to blob
  3. blockBlobClient.getBlobUrl + s"?$sharedAccessSignature"

Expected behavior
Every time the generated blob URL with SAS signature should be accessible

Additional context

I already checked below merged issues but did not help:

I observed some pattern for working url's and not working url's. the difference is only with sig parameter. not working one has + character in them.

Not Working:

sig=HnFiNxSp0BSvS+eg+bf5wHxOmxQJaPVqnqs81D+N6Eo=
sig=16TuQ7fhMNanms7x5W%2Fg+NzCRLfseDFDgB88rmb+XjU=
sig=8qgQKxaVnl0nUxX15bRt4VG7yxc7+Ppf9PqsPsxq5rE=
sig=Zfi3rhFiaD1zpY76kWIqRzJQ3Bl77%2F1b2DheP0wyN+E=
sig=Zfi3rhFiaD1zpY76kWIqRzJQ3Bl77%2F1b2DheP0wyN+E=
sig=D+EM63VkJc9wywZMH0sENjQVAHW8tiuCYbBMFeGfle4=
sig=OWVAzg0wAeS3r1MzIZkn+l8SbGKbKPrhjwa%2FdWbmoi8=
sig=q9+nQ1GSGWye9b318AJpFHHLWq4L0KQJzfazwku4MoM=
sig=v+w6XJSTzt%2FLvfNi7%2Flyy2hXMLI7AUgQ7e36BnYIDEc=

Working:
sig=r6GMuEPjB0dnxGHuGOX0F2ze3401ewntxK9T8JY%2FokA=
sig=IBzeKJBjnIN7vneV7JzhY8ZaqQKYD299rcj6i%2FecXGY=

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.StorageStorage Service (Queues, Blobs, Files)customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions