-
Notifications
You must be signed in to change notification settings - Fork 877
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
Do not sign Transfer-Encoding Header if present on the request #5895
Do not sign Transfer-Encoding Header if present on the request #5895
Conversation
@@ -68,7 +68,7 @@ public abstract class AbstractAws4Signer<T extends Aws4SignerParams, U extends A | |||
private static final FifoCache<SignerKey> SIGNER_CACHE = | |||
new FifoCache<>(SIGNER_CACHE_MAX_SIZE); | |||
private static final List<String> LIST_OF_HEADERS_TO_IGNORE_IN_LOWER_CASE = | |||
Arrays.asList("connection", "x-amzn-trace-id", "user-agent", "expect"); | |||
Arrays.asList("connection", "x-amzn-trace-id", "user-agent", "expect", "transfer-encoding"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the same list in HeaderTransformsHelper used by AwsS3V4ChunkSigner, do we need to add TE there also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope , it is not required here because SDK add only one Header(singletonMap) via this function , that is checksum header and its always "x-amz-checksum-XYZ"
Lines 104 to 106 in 6c74e87
Map<String, List<String>> canonicalizeSigningHeaders = canonicalizeSigningHeaders( | |
Collections.singletonMap(checksumHeaderForTrailer, Arrays.asList(BinaryUtils.toBase64(calculatedChecksum)))); | |
String canonicalizedHeaderString = getCanonicalizedHeaderString(canonicalizeSigningHeaders); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add it just to make it consistent , I think its better to add this just to be consistent and avoid further confusion , will add test directly on HeaderTransformsHelper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
982a946
to
ef305db
Compare
|
Motivation and Context
Currently, AWS SDKs sign the Transfer-Encoding chunked header during SigV4 authentication, causing signature validation failures in specific scenarios.
The issue occurs because Transfer-Encoding is a hop-by-hop header that intermediate proxies can modify.
This change proposes to stop signing the Transfer-Encoding header in SigV4(a).
Note : for Sigv4a signers using CRT it is done in crt side with awslabs/aws-c-auth#261
Modifications
LIST_OF_HEADERS_TO_IGNORE_IN_LOWER_CASE
which already skips some of predefined headersTesting
Transfer-Encoding
Screenshots (if appropriate)
Types of changes
License