Skip to content

Commit e70ecb4

Browse files
committed
Do not re-use sanitized request when forming signed request
1 parent d7d3892 commit e70ecb4

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/crt/internal/signer/DefaultAwsCrtV4aHttpSigner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ private static SignedRequest doSign(SignRequest<? extends AwsCredentialsIdentity
228228

229229
HttpRequest crtRequest = toRequest(sanitizedRequest, request.payload().orElse(null));
230230

231-
V4aContext v4aContext = sign(sanitizedRequest, crtRequest, signingConfig);
231+
V4aContext v4aContext = sign(requestBuilder.build(), crtRequest, signingConfig);
232232

233233
ContentStreamProvider payload = payloadSigner.sign(request.payload().orElse(null), v4aContext);
234234

services/s3/src/test/java/software/amazon/awssdk/services/s3/internal/resource/MultiRegionAccessPointEndpointResolutionTest.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import java.net.URI;
2323
import org.junit.jupiter.api.BeforeEach;
24-
import org.junit.jupiter.api.Disabled;
2524
import org.junit.jupiter.api.Test;
2625
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
2726
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
@@ -41,10 +40,8 @@
4140
public class MultiRegionAccessPointEndpointResolutionTest {
4241

4342
private final static String MULTI_REGION_ARN = "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap";
44-
// TODO(sra-identity-and-auth): The forward slash of the URL below was added to account for the signer behavior that
45-
// sanitizes the URI path, we need to double check that this behavior it's safe and that it won't break anything else.
4643
private final static URI MULTI_REGION_ENDPOINT =
47-
URI.create("https://mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com/");
44+
URI.create("https://mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com");
4845
private MockHttpClient mockHttpClient;
4946

5047
@BeforeEach
@@ -53,7 +50,6 @@ public void setup() {
5350
}
5451

5552
@Test
56-
@Disabled // Related to the TODO above on MULTI_REGION_ENDPOINT
5753
public void multiRegionArn_correctlyRewritesEndpoint() throws Exception {
5854
mockHttpClient.stubNextResponse(mockListObjectsResponse());
5955
S3Client s3Client = clientBuilder().serviceConfiguration(S3Configuration.builder().build()).build();
@@ -62,7 +58,6 @@ public void multiRegionArn_correctlyRewritesEndpoint() throws Exception {
6258
}
6359

6460
@Test
65-
@Disabled // Related to the TODO above on MULTI_REGION_ENDPOINT
6661
public void multiRegionArn_useArnRegionEnabled_correctlyRewritesEndpoint() throws Exception {
6762
mockHttpClient.stubNextResponse(mockListObjectsResponse());
6863
S3Client s3Client = clientBuilder().serviceConfiguration(S3Configuration.builder()
@@ -139,7 +134,6 @@ public void multiRegionArn_pathStyle_throwsIllegalArgumentException() throws Exc
139134
}
140135

141136
@Test
142-
@Disabled // Related to the TODO above on MULTI_REGION_ENDPOINT
143137
public void multiRegionArn_differentRegion_useArnRegionTrue() throws Exception {
144138
mockHttpClient.stubNextResponse(mockListObjectsResponse());
145139
S3Client s3Client = clientBuilder().build();

0 commit comments

Comments
 (0)