-
Notifications
You must be signed in to change notification settings - Fork 1.9k
S3 v4 Signature does not match #2010
Comments
What is the server returning when you are expecting a V4 signature? Does it look different than a V2 signature? Have you looked at the V4 test suite to verify the signature returned by the server? |
The server's returning JSON that looks like I've looked at the V4 test suite but I'm having trouble understanding how the different stages in the test suite interact with the requests FineUploader makes to S3 when chunking is enabled. |
I have conducted some research about this and found out folowing. The whole problem is when using S3 endpoint with bucket in URL - eg. getCanonicalUri: function(endOfUri) {
var path = endOfUri, queryParamIdx = endOfUri.indexOf("?");
if (queryParamIdx > 0) {
path = endOfUri.substr(0, queryParamIdx);
}
return "/" + path;
}, This function is returning only canonical path to the requested object but without the bucket name ( If you modify the code to this, it works. getCanonicalRequest: function(signatureSpec) {
return qq.format("{}\n{}\n{}\n{}\n{}\n{}", signatureSpec.method, v4.getCanonicalUri(signatureSpec.bucket, signatureSpec.endOfUrl), v4.getCanonicalQueryString(signatureSpec.endOfUrl), signatureSpec.headersStr || "\n", v4.getSignedHeaders(signatureSpec.headerNames), signatureSpec.hashedContent);
},
getCanonicalUri: function(bucket, endOfUri) {
var path = endOfUri, queryParamIdx = endOfUri.indexOf("?");
if (queryParamIdx > 0) {
path = endOfUri.substr(0, queryParamIdx);
}
return "/" + bucket + "/" + path;
}, But it's just a workaround. It definitely deserves a proper solution. |
Can someone open up a PR with the fix? I’ll be happy to take a look and get that released in a hotfix update |
I think creating a fix might be a little bit beyond my technical ability. @bagr001 would you be able to? |
I have to make a closer look at the bloblem. But as far as i know, it will be much more complex because it affects the esential part of the library, particulary how host, bucket and canonical Uri is being determinated. |
@bagr001 hmm, the code you pasted above doesn't seem to work for me. Did you have to make any changes to the server signing code as well? |
@JacobEvelyn can you provide more info about your configuration?
I am using nodeJs handler... |
Fine Uploader version
5.16.2
Browsers where the bug is reproducible
All
Operating systems where the bug is reproducible
macOS
All relevant Fine Uploader-related code that you have written
Detailed explanation of the problem
I'm not sure if this is a bug with FineUploader or the FineUploader PHP server (or, as I suspect, user error on my part). I had FineUploader working fine uploading directly to S3 using v2 signatures, but we'd like to switch to v4 signatures.
The exact code above, including the use of the example endpoint, works using the v2 signature. But when I switch to v4 I see this error from Amazon:
Am I missing something obvious?
The text was updated successfully, but these errors were encountered: