-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Protect the signature process against null terminators #3141
Comments
Hello @Dalzhim, Thanks for reaching out. Thanks, |
If you start with the PutMetricData example in the AWS documentation:
You just need to change the first line with the following snippet in order to reproduce the issue:
Now is it important to be able to proceed this way? Not inherently. What's important though is that applying the proposed solution can help save a lot of time to the library users who unknowingly break the signature process. |
Hello @Dalzhim Thanks for providing the information. Thanks, |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the feature
The following code leads to painful request signature issues for which solutions are hard to come by:
The reason this is a problem is that the null terminator is part of the
std::string
's content. When theAWSAuthV4Signer.cpp
builds theAuthorization
header for the request, it inserts the region into a StringStream, including the null-terminator. Later in the process, the header is effectively truncated in the middle of theCredential
parameter and the other parameters (SignedHeaders
andSignature
) are completely cut off.Use Case
Prevent obscure and preventable errors caused by unanticipated use of the SDK.
Proposed Solution
It would be trivial to prevent this kind of issue by streaming the underlying
char*
buffer of the string to defend against this kind of issue, like so:sstr << regionStr.c_str()
.Other Information
No response
Acknowledgements
The text was updated successfully, but these errors were encountered: