question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Signature Error for Query Containing Spaces Encoded as +

See original GitHub issue

Which service(blob, file, queue, table) does this issue concern?

Blob, but potentially others

Which version of the Azurite was used?

3.18.0

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

mcr.microsoft.com/azure-storage/azurite

What’s the Node.js version?

What problem was encountered?

As described in the URL standard spaces in a query string may be encoded as +, and not %20. This is what the standard Rust URL library will always do. As per the specification for Azure this will be URL-decoded as part of generating the canonical string to sign.

For example, GET http://localhost:10000/devstoreaccount1/tustvold?restype=container&comp=list&prefix=foo+bar%2F would result in

GET





Wed, 28 Sep 2022 16:38:41 GMT





x-ms-version:2021-08-06
/devstoreaccount1/devstoreaccount1/tustvold
comp:list
prefix:foo bar/
restype:container

However, making this request to azurite returns a signature error. My guess is it is only percent decoding the query parameters and not url decoding them, and therefore ends up with a different string to sign.

The same request to a Azure proper succeeds

Steps to reproduce the issue?

Noticed in https://github.com/apache/arrow-rs/pull/2801, let me know if you need a more specific example

Have you found a mitigation/solution?

No

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bluewwcommented, Nov 7, 2022

@tustvold Thanks for the info! I can repro it with shared key credential now.

It looks the problem is caused by decodeURIComponent() used in following line can’t pare “+” to space. https://github.com/Azure/Azurite/blob/24533376c9bb11ceef005eac5242738032f7196d/src/blob/authentication/BlobSharedKeyAuthenticator.ts#L311

decodeURIComponent("a%20b")
'a b'
decodeURIComponent("a+b")
'a+b'

I will look into it and update you later.

1reaction
tustvoldcommented, Sep 29, 2022

Thank you for the quick response, unfortunately the Rust URL library doesn’t provide a way to configure its escaping, at least as far as I’m aware.

We only use azurite for tests, and so I have just suppressed the test for this behaviour, and so there is no major rush from my end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Signature doesn't work when using spaces in url parameter
When I put this URL into my function, it doesn't work and I get an 400 error instead. My guess is that the...
Read more >
Bug in the way the API checks the signature since at least v9.7
Since upgrading from 9.3 to 9.7 and then 9.8 I am having problems working with the ... The tool I'm using is encoding...
Read more >
Using Query Parameters (AWS Signature Version 4)
Authenticate requests using the query parameters to express a request ... The space character is a reserved character and must be encoded as...
Read more >
Plus signs changed to space characters on redirect to final target
Space characters must be encoded in both path and query sections of the URI. ... A signed LogoutRequest sent over Redirect yields "Signature...
Read more >
How to fix URL contains whitespace issue - Sitechecker
The best way to resolve this issue is to have no spaces at all. Remove them and use allowed characters only — for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found