-
Notifications
You must be signed in to change notification settings - Fork 909
Fix Content-Length requirement, header updates in payload signer, http fallback to signed #4492
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
Fix Content-Length requirement, header updates in payload signer, http fallback to signed #4492
Conversation
9b81e1a
to
8c99bb1
Compare
@@ -291,4 +292,19 @@ public void sign_WithEventStreamContentTypeAndUnsignedPayload_Throws() { | |||
|
|||
assertThrows(UnsupportedOperationException.class, () -> signer.signAsync(request)); | |||
} | |||
|
|||
@Test | |||
public void sign_WithPayloadSigningFalseAndHttp_FallsBackToPayloadSigning() { |
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.
can we have additional test for sign_WithPayloadSigningNullAndHttp_DefaultsToPayloadSigning? I know the default is true, but this is double checking that our defaulting logic is fine in the face of http/https.
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.
Sure
8c99bb1
to
38a2fb9
Compare
38a2fb9
to
e96ef09
Compare
encodedContentLength += calculateChunksLength(contentLength, 0); | ||
break; | ||
case STREAMING_ECDSA_SIGNED_PAYLOAD_TRAILER: { | ||
long extensionsLength = 161; // ;chunk-signature:<sigv4a-ecsda hex signature, 64 bytes> |
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.
Fix comment
@@ -252,4 +254,21 @@ public static byte[] hash(byte[] data) { | |||
public static byte[] hash(String text) { | |||
return hash(text.getBytes(StandardCharsets.UTF_8)); | |||
} | |||
|
|||
private static int readAll(InputStream inputStream) { |
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.
Add comment why it's safe to use this method on the supplied stream
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.
Approving - didn't look at naming etc, which could be refactored later.
1ea28c4
to
aab03c8
Compare
SonarCloud Quality Gate failed.
|
Motivation and Context
Testing
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License