-
Notifications
You must be signed in to change notification settings - Fork 101
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
Problematic signature for S3 URLs requiring escaping #11
Comments
Thank you for digging into this! the |
I should note that as an experiment, I tweaked the proxy to blank out the request's Doing this actually fixed the behavior for the initial |
One thing I noticed along the way is the proxy is tied to SDK release 1.15.27; the SDK master branch is currently in the 1.19.x space. I'm going to play with the SDK signing behavior again using the 1.15.27 release to see if there's an issue. |
I checked things out for the 1.15.27 release and found that the SDK signing behavior for S3 HEAD requests seemed fine; I got found/not-found responses instead of 403's. So it does seem like something's amiss internal to the proxy itself. |
Upon further investigation into the
Having a separate instance of the signer, specifically for S3, is a somewhat invasive change in how the proxy is organized. I don't mind taking a crack at it, but would certainly welcome input beforehand. This nasty hack seems to fix the problems I described earlier.
|
As S3 URI paths should not be escaped within a signature, the S3 signing case cannot use the same signer instance as the general case (since URI path escaping is a field of the signer and not a per-signature parameter). This adds an `S3Signer` method to the proxy client and applies it appropriately. Resolves awslabs#11
As S3 URI paths should not be escaped within a signature, the S3 signing case cannot use the same signer instance as the general case (since URI path escaping is a field of the signer and not a per-signature parameter). This adds an `S3Signer` method to the proxy client and applies it appropriately. Resolves awslabs#11
Uncovered while testing key existence checks from various clients (an old jets3t in an old hadoop distro, an old python boto release, a recent ruby AWS SDK release, various direct HEAD requests from curl): it appears that the proxy produces a problematic signature in cases where an S3 key contains keys requiring URL escaping.
Our initial exposure this came from hadoop's old S3 native filesystem abstraction, which ultimately looks for keys with the suffix
_$folder$
. The key existence check was getting a permission denied response, rather than a found/not-found response, despite being a resource to which the proxy's credentials clearly granted access.To illustrate:
_$folder$
suffix. It doesn't matter if the key refers to extant object, we can illustrate the problem whether the object is there or not.If we issue a HEAD request (as all the clients I mentioned above do in this scenario) without escaping the key, we should get the suitable found/not-found HTTP result (assuming your perms correct):
Supposing that
foo_$folder$
doesn't exist inawesome-bucket
, you ought to see something like this:Now change the curl request to use the URI-escaped path instead (as the various clients mentioned above all do).
Now you'll get permission denied, even though this is actually the proper form of the request (at least according to my understanding).
This makes me suspect that the signer is:
It's very strange. If you play around with different escape-warranting characters in the path, you'll find multiple scenarios in which you get a 403 Forbidden response, which seems indicative of a consistent signature problem.
I'll continue digging into this but am somewhat flummoxed. I note further that the
$
character seems to have slightly different behavior than others; if you use a keyfoo_$
it'll be okay, but the escaped formfoo_%24
isn't. But try a different character, likefoo_<
, and neither the escaped nor unescaped form works. To be clear, I also tested these without the proxy, using the latest AWS golang SDK release, and there were no signature issues; the problem appears to originate within the proxy itself.The text was updated successfully, but these errors were encountered: