-
Notifications
You must be signed in to change notification settings - Fork 41
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
AwsV4Signer::sign invalid for S3 GET with signQuery #35
Comments
Huh! I might need to add a test specifically for S3 GET – I have one for POST. It might just be a matter of messing with this logic: Lines 170 to 172 in 447d747
Either use Will need some testing in any case 🤔 |
Looked into that if statement but ran into some issues for the AwsClient.fetch function throwing an arrayBuffer error, which I haven't had time to look into. However checking for this when filtering I might have gone overboard with checking for this exact use case but as long as this.signableHeaders = ['host', ...this.headers.keys()]
.filter(header => {
if (header === 'x-amz-content-sha256' && !allHeaders && signQuery && this.service.toLowerCase() === 's3' && this.method.toUpperCase() === 'GET' && this.headers.get(header) === 'UNSIGNED-PAYLOAD') {
return false
}
return allHeaders || !UNSIGNABLE_HEADERS.includes(header)
})
.sort() |
If someone were to put up a PR for this, would @mhart be happy to review, approve, merge, publish etc? |
Closes cloudflare#5095 Holding off on presigned examples due to a bug in aws4fetch - refer to mhart/aws4fetch#35
Closes cloudflare#5095 Holding off on presigned examples due to a bug in aws4fetch - refer to mhart/aws4fetch#35
Closes cloudflare#5095 Holding off on presigned examples due to a bug in aws4fetch - refer to mhart/aws4fetch#35
* [R2] Add aws4fetch example Closes #5095 Holding off on presigned examples due to a bug in aws4fetch - refer to mhart/aws4fetch#35 * Update content/r2/examples/aws4fetch.md * Update content/r2/examples/aws4fetch.md Co-authored-by: Kate Tungusova <70746074+deadlypants1973@users.noreply.github.com>
Finally got around to addressing this 😅 Published as v1.0.14 Hope that doesn't break anyone! |
When I use
aws s3 presign
like this,I get a URL like this, which works.
But when I use AwsV4Signer::sign like this,
I get a URL like this, which does not work.
It seems that aws4fetch is adding the
x-amz-content-sha256
to the signed headers (and omitting it from the querystring), which apparently is not correct for querystring signatures.I fixed this for my limited use case by adding
'x-amz-content-sha256'
toUNSIGNABLE_HEADERS
, but I imagine this would break signing for non-querystring, non-GET cases.The text was updated successfully, but these errors were encountered: