-
Notifications
You must be signed in to change notification settings - Fork 1
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
ECS .NET SDK request signature does not match bug #4
Comments
Hi @ben-schumacher how are you doing? is this addressed on https://github.com/EMCECS/ecs-object-client-dotnet/releases/tag/v1.0.2 ? thanks and have a nice day! |
Hi @sballarati, yes this was resolved in v1.0.2. Please let me know if you have any questions or further issues. |
Hi @ben-schumacher thank you, we've re-tested and some were fixed but not all. Below the ones working and supported by the JAVA SDK: Continue to fail
By comparing the JAVA source code we noticed the special chars are being handled but not done in the NET SDK. Thanks for looking into it! |
Hi @sballarati , Because the ecs-object-client-dotnet SDK is merely an extension (using .net extension methods) of the real AWS SDK, we're still letting the AWSSDK.Core library handle all other aspects of the request/response logic. In other words, you will encounter this same issue using the AWS SDK. I agree, this doesn't align exactly to how the Java SDK works. If that's needed, we would need to incorporate some sort of handler for these specific metadata characters. Have you looked at possibly incorporating that code to accomplish what you're asking for? As of our latest release, the SDK is working as intended. Ben |
hi Ben @ben-schumacher , I totally follow, we've also tried that out and found that we would end up opening an issue to the AWS SDK. Our main concern is that someone using the JAVA SDK can set those special chars within the metadata keys but then, someone trying to update the metadata using the NET SDK won't be able to do it. Right? |
@sballarati , |
There are 22 ASCII characters that will work with the JAVA SDK but not with the .NET SDK when being set as as part of the metadata keys.
ECS returns Http code 403 with message:
Analysis
When the SDK signs the request that will be verified on the server, it orders the keys (headers) using "
StringComparer.OrdinalIgnoreCase
". But, on the server, the JAVA version generates a different signature, thus, it does not match and throws a 403 Signature Does not matchMethod:
static string BuildCanonicalizedHeaders(IDictionary<string, string> headers)
Class:
S3SignerECS
Version: v1.0.1
Repro steps
You can find attached two unit test projects showcasing the bug, one for NET and one for JAVA.
If you run the same example, you will notice with the JAVA SDK, you won't get the Signature match error. Most likely because the JAVA SDK uses the TreeMap class that performs a natural ordering.
dotnetUnderscoreECSTest.zip
JavaUnderscoreECSTest2.zip
Solution
We'd need a fix on the .NET SDK that signs the request same way the JAVA one does.
The text was updated successfully, but these errors were encountered: