-
Notifications
You must be signed in to change notification settings - Fork 997
Disable payload signing for https requests #6691
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
Closed
RanVaknin
wants to merge
5
commits into
master
from
rvaknin/disable-payload-signing-for-https-requests
Closed
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2d34fd3
Disable payload signing for HTTPS requests
RanVaknin 04ba7d4
Update Javadoc
RanVaknin 8e59fcd
Add changelog
RanVaknin 5501942
Fix tests with new default behavior
RanVaknin e92f447
Fix tangential fixture tests, fix javadoc, fix ChecksumUtil logic
RanVaknin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "type": "feature", | ||
| "category": "AWS SDK for Java v2", | ||
| "contributor": "", | ||
| "description": "HTTPS requests now skip payload signing by default for improved performance. HTTP and signing-dependent features are unaffected." | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,7 +140,7 @@ void sign_withBasicRequest_shouldSignWithHeaders() { | |
| assertThat(signedRequest.request().firstMatchingHeader("X-Amz-Date")).hasValue("20200803T174823Z"); | ||
| assertThat(signedRequest.request().firstMatchingHeader("X-Amz-Region-Set")).hasValue("aws-global"); | ||
| assertThat(signedRequest.request().firstMatchingHeader("Authorization")).isPresent(); | ||
| assertThat(signedRequest.request().firstMatchingHeader("x-amz-content-sha256")).contains(PAYLOAD_SHA256_HEX); | ||
| assertThat(signedRequest.request().firstMatchingHeader("x-amz-content-sha256")).hasValue("UNSIGNED-PAYLOAD"); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing default behavior |
||
| } | ||
|
|
||
| @Test | ||
|
|
@@ -172,7 +172,7 @@ void signAsync_withBasicRequest_shouldSignWithHeaders() { | |
| assertThat(signedRequest.request().firstMatchingHeader("X-Amz-Date")).hasValue("20200803T174823Z"); | ||
| assertThat(signedRequest.request().firstMatchingHeader("X-Amz-Region-Set")).hasValue("aws-global"); | ||
| assertThat(signedRequest.request().firstMatchingHeader("Authorization")).isPresent(); | ||
| assertThat(signedRequest.request().firstMatchingHeader("x-amz-content-sha256")).contains(PAYLOAD_SHA256_HEX); | ||
| assertThat(signedRequest.request().firstMatchingHeader("x-amz-content-sha256")).hasValue("UNSIGNED-PAYLOAD"); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing default behavior |
||
| } | ||
|
|
||
| @Test | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
...rc/main/java/software/amazon/awssdk/benchmark/signer/DynamoDbPayloadSigningBenchmark.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"). | ||
| * You may not use this file except in compliance with the License. | ||
| * A copy of the License is located at | ||
| * | ||
| * http://aws.amazon.com/apache2.0 | ||
| * | ||
| * or in the "license" file accompanying this file. This file is distributed | ||
| * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
| * express or implied. See the License for the specific language governing | ||
| * permissions and limitations under the License. | ||
| */ | ||
|
|
||
| package software.amazon.awssdk.benchmark.signer; | ||
|
|
||
| import java.net.URI; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import java.util.Random; | ||
| import java.util.concurrent.TimeUnit; | ||
| import org.openjdk.jmh.annotations.Benchmark; | ||
| import org.openjdk.jmh.annotations.BenchmarkMode; | ||
| import org.openjdk.jmh.annotations.Fork; | ||
| import org.openjdk.jmh.annotations.Level; | ||
| import org.openjdk.jmh.annotations.Measurement; | ||
| import org.openjdk.jmh.annotations.Mode; | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit; | ||
| import org.openjdk.jmh.annotations.Param; | ||
| import org.openjdk.jmh.annotations.Scope; | ||
| import org.openjdk.jmh.annotations.Setup; | ||
| import org.openjdk.jmh.annotations.State; | ||
| import org.openjdk.jmh.annotations.TearDown; | ||
| import org.openjdk.jmh.annotations.Warmup; | ||
| import org.openjdk.jmh.infra.Blackhole; | ||
| import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; | ||
| import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; | ||
| import software.amazon.awssdk.benchmark.utils.MockHttpClient; | ||
| import software.amazon.awssdk.core.SdkBytes; | ||
| import software.amazon.awssdk.regions.Region; | ||
| import software.amazon.awssdk.services.dynamodb.DynamoDbClient; | ||
| import software.amazon.awssdk.services.dynamodb.model.AttributeValue; | ||
| import software.amazon.awssdk.services.dynamodb.model.PutItemRequest; | ||
| import software.amazon.awssdk.services.dynamodb.model.PutItemResponse; | ||
|
|
||
| @State(Scope.Thread) | ||
| @BenchmarkMode(Mode.SampleTime) | ||
| @OutputTimeUnit(TimeUnit.MICROSECONDS) | ||
| @Warmup(iterations = 5) | ||
| @Measurement(iterations = 5) | ||
| @Fork(2) | ||
| public class DynamoDbPayloadSigningBenchmark { | ||
|
|
||
| @Param({"10240", "409600"}) | ||
| private int payloadSize; | ||
|
|
||
| private DynamoDbClient client; | ||
| private PutItemRequest putRequest; | ||
|
|
||
| @Setup(Level.Trial) | ||
| public void setup() { | ||
| client = DynamoDbClient.builder() | ||
| .region(Region.US_EAST_1) | ||
| .endpointOverride(URI.create("https://dynamodb.us-east-1.amazonaws.com")) | ||
| .credentialsProvider(StaticCredentialsProvider.create( | ||
| AwsBasicCredentials.create("AKIATEST", "testSecretKey"))) | ||
| .httpClient(new MockHttpClient("{}", "{}")) | ||
| .build(); | ||
|
|
||
| byte[] data = new byte[payloadSize]; | ||
| new Random(42).nextBytes(data); | ||
|
|
||
| Map<String, AttributeValue> item = new HashMap<>(); | ||
| item.put("id", AttributeValue.builder().s("test-id").build()); | ||
| item.put("data", AttributeValue.builder().b(SdkBytes.fromByteArray(data)).build()); | ||
|
|
||
| putRequest = PutItemRequest.builder() | ||
| .tableName("test-table") | ||
| .item(item) | ||
| .build(); | ||
| } | ||
|
|
||
| @TearDown(Level.Trial) | ||
| public void tearDown() { | ||
| client.close(); | ||
| } | ||
|
|
||
| @Benchmark | ||
| public void putItem(Blackhole blackhole) { | ||
| PutItemResponse response = client.putItem(putRequest); | ||
| blackhole.consume(response); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If payloadSigningEnabled is not null, i.e., configured by the user or set on the service model, should we always enable payload signing regardless of isEncrypted?