fix(s3): ignore hoisted upload checksum query parameters (#5977)

* fix(s3): ignore hoisted upload checksum query parameters

* fix(s3): ignore hoisted multipart checksum types
This commit is contained in:
Huan Jiang authored and GitHub committed 2026-10-19 09:30:12 -04:00
1 parent 49d2d74f3f
commit 3a913ca8d6
4 files changed
+279 -53

No files matched your search

@@ -70,6 +70,45 @@ class S3PresignTest {
}
}
@Test
@DisplayName("#5965 presigned PUT ignores the JS SDK's hoisted empty-body checksum")
void presignedPutWithHoistedEmptyBodyChecksumUploadsSuccessfully() throws Exception {
String content = "not an empty body";
PutObjectRequest request = PutObjectRequest.builder()
.bucket(BUCKET)
.key(KEY)
.overrideConfiguration(config -> config
.putRawQueryParameter("x-amz-checksum-crc32", "AAAAAA==")
.putRawQueryParameter("x-amz-sdk-checksum-algorithm", "CRC32"))
.build();
PresignedPutObjectRequest presigned = presigner.presignPutObject(
PutObjectPresignRequest.builder()
.signatureDuration(Duration.ofMinutes(10))
.putObjectRequest(request)
.build());
assertThat(presigned.url().toURI().getRawQuery()).contains("x-amz-checksum-crc32=AAAAAA%3D%3D");
HttpURLConnection connection = (HttpURLConnection) presigned.url().openConnection();
try {
connection.setRequestMethod("PUT");
connection.setDoOutput(true);
byte[] body = content.getBytes(StandardCharsets.UTF_8);
connection.setFixedLengthStreamingMode(body.length);
try (OutputStream output = connection.getOutputStream()) {
output.write(body);
}
assertThat(connection.getResponseCode()).isEqualTo(200);
try (InputStream response = connection.getInputStream()) {
assertThat(response.readAllBytes()).isEmpty();
}
} finally {
connection.disconnect();
}
assertThat(s3.getObjectAsBytes(GetObjectRequest.builder().bucket(BUCKET).key(KEY).build())
.asUtf8String()).isEqualTo(content);
}
@Test
@DisplayName("#932 presigned PUT with tagging signed header uploads successfully")
void presignedPutWithTaggingSignedHeaderUploadsSuccessfully() throws Exception {
+6
View File
@@ -350,6 +350,12 @@ For a signed request, verification rebuilds the canonical request from the wire
A workload must sign with credentials Floci can verify once either flag is on. A container Floci launches without a role, such as a Lambda function with no execution role, is given placeholder credentials that no flag accepts, so give it a role, or sign with `test`/`test`.
Presigned uploads ignore checksum values, algorithms, and types supplied only in the query
string, matching AWS S3. This includes the empty-body CRC32 (`AAAAAA==`) that the JavaScript SDK
adds when presigning before the file is available. These parameters still participate in signature
verification, but are not used to validate the body or stored as the object's checksum. Actual
checksum headers and streaming checksum trailers remain validated as usual.
## Bucket Policy Enforcement
Floci evaluates S3 bucket policies for authenticated (signed) requests when policy enforcement is enabled. Two flags control this evaluation:
@@ -913,7 +913,7 @@ public class S3Controller {
ObjectLockHeaders lock = objectLockHeaders(httpHeaders);
String checksumAlgorithm = getChecksumAlgorithm(httpHeaders, uriInfo);
String checksumAlgorithm = getChecksumAlgorithm(httpHeaders);
String persistedEncoding = toPersistedContentEncoding(contentEncoding);
String contentDisposition = httpHeaders.getHeaderString("Content-Disposition");
String cacheControl = httpHeaders.getHeaderString("Cache-Control");
@@ -949,7 +949,7 @@ public class S3Controller {
.withGrantReadAcp(httpHeaders.getHeaderString("x-amz-grant-read-acp"))
.withGrantWriteAcp(httpHeaders.getHeaderString("x-amz-grant-write-acp"))
.withChecksumAlgorithm(checksumAlgorithm)
.withClientChecksum(extractChecksum(httpHeaders, uriInfo))
.withClientChecksum(extractChecksum(httpHeaders))
.withIfMatch(ifMatch)
.withIfNoneMatch(ifNoneMatch)
.withTagging(inlineTags));
@@ -1622,7 +1622,7 @@ public class S3Controller {
authorizeObjectCreation(bucket, key, httpHeaders, uriInfo, false, authorization);
MultipartUpload upload = s3Service.initiateMultipartUpload(bucket, key, contentType,
extractUserMetadata(httpHeaders, uriInfo),
resolveHeaderOrQueryParam(httpHeaders, uriInfo, "x-amz-checksum-type"),
httpHeaders.getHeaderString("x-amz-checksum-type"),
new PutObjectOptions()
.withStorageClass(httpHeaders.getHeaderString("x-amz-storage-class"))
.withContentDisposition(httpHeaders.getHeaderString("Content-Disposition"))
@@ -1635,7 +1635,7 @@ public class S3Controller {
"x-amz-server-side-encryption-customer-key"))
.withSseCustomerKeyMd5(httpHeaders.getHeaderString(
"x-amz-server-side-encryption-customer-key-MD5"))
.withChecksumAlgorithm(getChecksumAlgorithm(httpHeaders, uriInfo))
.withChecksumAlgorithm(getChecksumAlgorithm(httpHeaders))
.withAcl(httpHeaders.getHeaderString("x-amz-acl"))
.withGrantRead(httpHeaders.getHeaderString("x-amz-grant-read"))
.withGrantWrite(httpHeaders.getHeaderString("x-amz-grant-write"))
@@ -1691,8 +1691,8 @@ public class S3Controller {
if (preconditionResponse != null) {
return preconditionResponse;
}
String checksumType = resolveHeaderOrQueryParam(httpHeaders, uriInfo, "x-amz-checksum-type");
S3Checksum expectedChecksum = extractChecksum(httpHeaders, uriInfo);
String checksumType = httpHeaders.getHeaderString("x-amz-checksum-type");
S3Checksum expectedChecksum = extractChecksum(httpHeaders);
S3Object obj = s3Service.completeMultipartUpload(bucket, key, uploadId, partNumbers,
completedPartETags(completedParts), completedPartChecksums(completedParts), checksumType,
expectedChecksum, multipartObjectSize(httpHeaders, uriInfo));
@@ -2764,7 +2764,7 @@ public class S3Controller {
httpHeaders.getHeaderString("x-amz-content-sha256"));
String annotationName = uriInfo.getQueryParameters().getFirst("annotationName");
String versionId = uriInfo.getQueryParameters().getFirst("versionId");
String algorithmHeader = getChecksumAlgorithm(httpHeaders, uriInfo);
String algorithmHeader = getChecksumAlgorithm(httpHeaders);
ChecksumAlgorithm algorithm = ChecksumAlgorithm.fromWireValue(algorithmHeader);
validateChecksumHeaders(httpHeaders, uriInfo, payload);
ObjectAnnotation annotation = s3Service.putObjectAnnotation(bucket, key, annotationName,
@@ -3200,7 +3200,7 @@ public class S3Controller {
.withCopySourceSseCustomerAlgorithm(httpHeaders.getHeaderString("x-amz-copy-source-server-side-encryption-customer-algorithm"))
.withCopySourceSseCustomerKey(httpHeaders.getHeaderString("x-amz-copy-source-server-side-encryption-customer-key"))
.withCopySourceSseCustomerKeyMd5(httpHeaders.getHeaderString("x-amz-copy-source-server-side-encryption-customer-key-MD5"))
.withChecksumAlgorithm(getChecksumAlgorithm(httpHeaders, uriInfo))
.withChecksumAlgorithm(getChecksumAlgorithm(httpHeaders))
.withAnnotationDirective(annotationDirective)
.withAcl(cannedAcl)
.withGrantRead(httpHeaders.getHeaderString("x-amz-grant-read"))
@@ -3461,12 +3461,13 @@ public class S3Controller {
return null;
}
private S3Checksum extractChecksum(HttpHeaders httpHeaders, UriInfo uriInfo) {
String crc32 = resolveHeaderOrQueryParam(httpHeaders, uriInfo, "x-amz-checksum-crc32");
String crc32c = resolveHeaderOrQueryParam(httpHeaders, uriInfo, "x-amz-checksum-crc32c");
String crc64nvme = resolveHeaderOrQueryParam(httpHeaders, uriInfo, "x-amz-checksum-crc64nvme");
String sha1 = resolveHeaderOrQueryParam(httpHeaders, uriInfo, "x-amz-checksum-sha1");
String sha256 = resolveHeaderOrQueryParam(httpHeaders, uriInfo, "x-amz-checksum-sha256");
private S3Checksum extractChecksum(HttpHeaders httpHeaders) {
// AWS signs hoisted checksum query parameters but does not use them as integrity headers.
String crc32 = httpHeaders.getHeaderString("x-amz-checksum-crc32");
String crc32c = httpHeaders.getHeaderString("x-amz-checksum-crc32c");
String crc64nvme = httpHeaders.getHeaderString("x-amz-checksum-crc64nvme");
String sha1 = httpHeaders.getHeaderString("x-amz-checksum-sha1");
String sha256 = httpHeaders.getHeaderString("x-amz-checksum-sha256");
if (crc32 == null && crc32c == null && crc64nvme == null && sha1 == null && sha256 == null) {
return null;
}
@@ -3480,10 +3481,10 @@ public class S3Controller {
return checksum;
}
private String getChecksumAlgorithm(HttpHeaders httpHeaders, UriInfo uriInfo) {
String algorithm = resolveHeaderOrQueryParam(httpHeaders, uriInfo, "x-amz-checksum-algorithm");
private String getChecksumAlgorithm(HttpHeaders httpHeaders) {
String algorithm = httpHeaders.getHeaderString("x-amz-checksum-algorithm");
if (algorithm == null || algorithm.isBlank()) {
algorithm = resolveHeaderOrQueryParam(httpHeaders, uriInfo, "x-amz-sdk-checksum-algorithm");
algorithm = httpHeaders.getHeaderString("x-amz-sdk-checksum-algorithm");
}
return algorithm;
}
@@ -3503,7 +3504,7 @@ public class S3Controller {
private UploadChecksums uploadChecksums(HttpHeaders httpHeaders, UriInfo uriInfo) {
Map<ChecksumAlgorithm, String> claimed = new EnumMap<>(ChecksumAlgorithm.class);
for (ChecksumAlgorithm algorithm : ChecksumAlgorithm.values()) {
String value = resolveHeaderOrQueryParam(httpHeaders, uriInfo, "x-amz-checksum-" + algorithm.wireValue());
String value = httpHeaders.getHeaderString("x-amz-checksum-" + algorithm.wireValue());
if (value != null) {
claimed.put(algorithm, value);
}
@@ -23,6 +23,7 @@ import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
@QuarkusTest
@TestProfile(S3EnforceAuthProfile.class)
@@ -36,12 +37,14 @@ class S3PresignedChecksumIntegrationTest {
DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'").withZone(ZoneOffset.UTC);
@Test
void presignedPutWithMismatchedChecksumCrc32InQueryFailsWith400BadDigest() throws Exception {
void presignedPutWithSdkEmptyBodyChecksumInQueryIgnoresIt() throws Exception {
createBucket();
String path = "/" + BUCKET + "/mismatched-crc32.txt";
// SDK JS v3 presigner ký CRC32 của empty payload (AAAAAA==) khi chưa có body tại thời điểm ký
// JS SDK v3 presigns before the body is known; AWS ignores this hoisted empty-body checksum.
String emptyPayloadCrc32 = S3Checksum.crc32Base64(new byte[0]);
String url = presign("PUT", path, Map.of("x-amz-checksum-crc32", emptyPayloadCrc32), Map.of());
String url = presign("PUT", path, Map.of(
"x-amz-checksum-crc32", emptyPayloadCrc32,
"x-amz-sdk-checksum-algorithm", "CRC32"), Map.of());
byte[] body = "not an empty body".getBytes(StandardCharsets.UTF_8);
given()
@@ -50,22 +53,30 @@ class S3PresignedChecksumIntegrationTest {
.when()
.put(url)
.then()
.statusCode(400)
.body(containsString("BadDigest"))
.body(containsString("The CRC32 you specified did not match the calculated checksum."));
.statusCode(200)
.header("x-amz-checksum-crc32", nullValue());
// Xác nhận object không được lưu vào storage
given()
.filter(LOCAL_SIGNER)
.when()
.get(path)
.then()
.statusCode(404)
.body(containsString("NoSuchKey"));
.statusCode(200)
.body(equalTo(new String(body, StandardCharsets.UTF_8)));
given()
.filter(LOCAL_SIGNER)
.header("x-amz-checksum-mode", "ENABLED")
.when()
.head(path)
.then()
.statusCode(200)
.header("x-amz-checksum-crc32", nullValue())
.header("x-amz-checksum-crc64nvme", equalTo(S3Checksum.crc64NvmeBase64(body)));
}
@Test
void presignedPutWithMatchingChecksumCrc32InQuerySucceedsAndStoresChecksum() throws Exception {
void presignedPutWithMatchingChecksumInQueryDoesNotStoreIt() throws Exception {
createBucket();
String path = "/" + BUCKET + "/matching-crc32.txt";
byte[] body = "hello presigned checksum world".getBytes(StandardCharsets.UTF_8);
@@ -80,9 +91,8 @@ class S3PresignedChecksumIntegrationTest {
.then()
.statusCode(200)
.header("ETag", notNullValue())
.header("x-amz-checksum-crc32", equalTo(expectedCrc32));
.header("x-amz-checksum-crc32", nullValue());
// Kiểm tra HeadObject với x-amz-checksum-mode=ENABLED trả về checksum đã lưu
given()
.filter(LOCAL_SIGNER)
.header("x-amz-checksum-mode", "ENABLED")
@@ -90,15 +100,16 @@ class S3PresignedChecksumIntegrationTest {
.head(path)
.then()
.statusCode(200)
.header("x-amz-checksum-crc32", equalTo(expectedCrc32));
.header("x-amz-checksum-crc32", nullValue())
.header("x-amz-checksum-crc64nvme", equalTo(S3Checksum.crc64NvmeBase64(body)));
}
@Test
void presignedPutWithChecksumAlgorithmInQueryComputesAndStoresChecksum() throws Exception {
void presignedPutWithChecksumAlgorithmInQueryUsesDefaultChecksum() throws Exception {
createBucket();
String path = "/" + BUCKET + "/algorithm-query.txt";
byte[] body = "calculate crc32 from algorithm query param".getBytes(StandardCharsets.UTF_8);
String expectedCrc32 = S3Checksum.crc32Base64(body);
String expectedChecksum = S3Checksum.crc64NvmeBase64(body);
String url = presign("PUT", path, Map.of("x-amz-checksum-algorithm", "CRC32"), Map.of());
given()
@@ -108,9 +119,9 @@ class S3PresignedChecksumIntegrationTest {
.put(url)
.then()
.statusCode(200)
.header("x-amz-checksum-crc32", equalTo(expectedCrc32));
.header("x-amz-checksum-crc32", nullValue())
.header("x-amz-checksum-crc64nvme", equalTo(expectedChecksum));
// Query param x-amz-checksum-mode=ENABLED trên presigned GET cũng phải trả về checksum
String getUrl = presign("GET", path, Map.of("x-amz-checksum-mode", "ENABLED"), Map.of());
given()
.urlEncodingEnabled(false)
@@ -118,12 +129,12 @@ class S3PresignedChecksumIntegrationTest {
.get(getUrl)
.then()
.statusCode(200)
.header("x-amz-checksum-crc32", equalTo(expectedCrc32))
.header("x-amz-checksum-crc64nvme", equalTo(expectedChecksum))
.body(equalTo(new String(body, StandardCharsets.UTF_8)));
}
@Test
void presignedPutWithMismatchedSha256InQueryFailsWith400BadDigest() throws Exception {
void presignedPutWithMismatchedSha256InQueryIgnoresIt() throws Exception {
createBucket();
String path = "/" + BUCKET + "/mismatched-sha256.txt";
String invalidSha256 = S3Checksum.sha256Base64("other content".getBytes(StandardCharsets.UTF_8));
@@ -135,18 +146,16 @@ class S3PresignedChecksumIntegrationTest {
.when()
.put(url)
.then()
.statusCode(400)
.body(containsString("BadDigest"))
.body(containsString("The SHA256 you specified did not match the calculated checksum."));
.statusCode(200)
.header("x-amz-checksum-sha256", nullValue());
}
@Test
void presignedUploadPartWithMismatchedChecksumQueryParamFailsWith400BadDigest() throws Exception {
void presignedUploadPartWithMismatchedChecksumQueryParamIgnoresIt() throws Exception {
createBucket();
String key = "multipart-checksum.txt";
String path = "/" + BUCKET + "/" + key;
// Khởi tạo multipart upload
String uploadId = given()
.filter(LOCAL_SIGNER)
.when()
@@ -155,26 +164,95 @@ class S3PresignedChecksumIntegrationTest {
.statusCode(200)
.extract().xmlPath().getString("InitiateMultipartUploadResult.UploadId");
// Tạo presigned URL cho upload part có x-amz-checksum-crc32 sai
String partPath = path;
String wrongCrc32 = S3Checksum.crc32Base64(new byte[0]);
String partUrl = presign("PUT", partPath,
String partUrl = presign("PUT", path,
Map.of("uploadId", uploadId, "partNumber", "1", "x-amz-checksum-crc32", wrongCrc32),
Map.of());
given()
String etag = given()
.urlEncodingEnabled(false)
.body("part data not matching empty crc32".getBytes(StandardCharsets.UTF_8))
.when()
.put(partUrl)
.then()
.statusCode(400)
.body(containsString("BadDigest"))
.body(containsString("The CRC32 you specified did not match the calculated checksum."));
.statusCode(200)
.header("x-amz-checksum-crc32", nullValue())
.extract().header("ETag");
String completeUrl = presign("POST", path,
Map.of("uploadId", uploadId, "x-amz-checksum-type", "COMPOSITE"), Map.of());
given()
.urlEncodingEnabled(false)
.body("<CompleteMultipartUpload><Part><PartNumber>1</PartNumber><ETag>" + etag
+ "</ETag></Part></CompleteMultipartUpload>")
.when()
.post(completeUrl)
.then()
.statusCode(200);
given()
.filter(LOCAL_SIGNER)
.when()
.get(path)
.then()
.statusCode(200)
.body(equalTo("part data not matching empty crc32"));
}
@Test
void presignedCopyObjectWithChecksumAlgorithmInQueryComputesAndStoresChecksum() throws Exception {
void presignedCreateMultipartUploadWithQueryChecksumSettingsIgnoresThem() throws Exception {
createBucket();
String path = "/" + BUCKET + "/multipart-query-settings.txt";
String url = presign("POST", path, Map.of("uploads", "",
"x-amz-checksum-algorithm", "CRC32", "x-amz-checksum-type", "FULL_OBJECT"), Map.of());
String uploadId = given()
.urlEncodingEnabled(false)
.when()
.post(url)
.then()
.statusCode(200)
.header("x-amz-checksum-algorithm", nullValue())
.header("x-amz-checksum-type", nullValue())
.extract().xmlPath().getString("InitiateMultipartUploadResult.UploadId");
given()
.filter(LOCAL_SIGNER)
.when()
.delete(path + "?uploadId=" + uploadId)
.then()
.statusCode(204);
}
@Test
void presignedCreateMultipartUploadWithChecksumHeadersPreservesThem() throws Exception {
createBucket();
String path = "/" + BUCKET + "/multipart-header-settings.txt";
String url = presign("POST", path, Map.of("uploads", ""),
Map.of("x-amz-checksum-algorithm", "CRC32", "x-amz-checksum-type", "FULL_OBJECT"));
String uploadId = given()
.urlEncodingEnabled(false)
.header("x-amz-checksum-algorithm", "CRC32")
.header("x-amz-checksum-type", "FULL_OBJECT")
.when()
.post(url)
.then()
.statusCode(200)
.header("x-amz-checksum-algorithm", equalTo("CRC32"))
.header("x-amz-checksum-type", equalTo("FULL_OBJECT"))
.extract().xmlPath().getString("InitiateMultipartUploadResult.UploadId");
given()
.filter(LOCAL_SIGNER)
.when()
.delete(path + "?uploadId=" + uploadId)
.then()
.statusCode(204);
}
@Test
void presignedCopyObjectWithChecksumAlgorithmInQueryPreservesSourceChecksum() throws Exception {
createBucket();
String sourcePath = "/" + BUCKET + "/copy-source.txt";
byte[] body = "copy source content for checksum test".getBytes(StandardCharsets.UTF_8);
@@ -187,7 +265,7 @@ class S3PresignedChecksumIntegrationTest {
.statusCode(200);
String destPath = "/" + BUCKET + "/copy-dest.txt";
String expectedSha256 = S3Checksum.sha256Base64(body);
String expectedChecksum = S3Checksum.crc64NvmeBase64(body);
String copyUrl = presign("PUT", destPath,
Map.of("x-amz-checksum-algorithm", "SHA256"),
Map.of("x-amz-copy-source", "/" + BUCKET + "/copy-source.txt"));
@@ -200,7 +278,7 @@ class S3PresignedChecksumIntegrationTest {
.then()
.statusCode(200)
.body(containsString("CopyObjectResult"))
.body(containsString("<ChecksumSHA256>" + expectedSha256 + "</ChecksumSHA256>"));
.body(containsString("<ChecksumCRC64NVME>" + expectedChecksum + "</ChecksumCRC64NVME>"));
given()
.filter(LOCAL_SIGNER)
@@ -209,7 +287,109 @@ class S3PresignedChecksumIntegrationTest {
.head(destPath)
.then()
.statusCode(200)
.header("x-amz-checksum-sha256", equalTo(expectedSha256));
.header("x-amz-checksum-sha256", nullValue())
.header("x-amz-checksum-crc64nvme", equalTo(expectedChecksum));
}
@Test
void presignedPutWithMatchingChecksumHeaderStoresItDespiteMismatchedQuery() throws Exception {
createBucket();
String path = "/" + BUCKET + "/matching-header.txt";
byte[] body = "checksum header takes precedence".getBytes(StandardCharsets.UTF_8);
String checksum = S3Checksum.crc32Base64(body);
String url = presign("PUT", path,
Map.of("x-amz-checksum-crc32", "AAAAAA=="),
Map.of("x-amz-checksum-crc32", checksum, "x-amz-sdk-checksum-algorithm", "CRC32"));
given()
.urlEncodingEnabled(false)
.header("x-amz-checksum-crc32", checksum)
.header("x-amz-sdk-checksum-algorithm", "CRC32")
.body(body)
.when()
.put(url)
.then()
.statusCode(200)
.header("x-amz-checksum-crc32", equalTo(checksum));
given()
.filter(LOCAL_SIGNER)
.header("x-amz-checksum-mode", "ENABLED")
.when()
.head(path)
.then()
.statusCode(200)
.header("x-amz-checksum-crc32", equalTo(checksum));
}
@Test
void presignedPutWithMismatchedChecksumHeaderFailsDespiteMatchingQuery() throws Exception {
createBucket();
String path = "/" + BUCKET + "/mismatched-header.txt";
byte[] body = "body does not match the header".getBytes(StandardCharsets.UTF_8);
String url = presign("PUT", path,
Map.of("x-amz-checksum-crc32", S3Checksum.crc32Base64(body)),
Map.of("x-amz-checksum-crc32", "AAAAAA=="));
given()
.urlEncodingEnabled(false)
.header("x-amz-checksum-crc32", "AAAAAA==")
.body(body)
.when()
.put(url)
.then()
.statusCode(400)
.body(containsString("BadDigest"));
given()
.filter(LOCAL_SIGNER)
.when()
.head(path)
.then()
.statusCode(404);
}
@Test
void presignedPutWithTamperedChecksumQueryIsRejected() throws Exception {
createBucket();
String path = "/" + BUCKET + "/tampered-query.txt";
String url = presign("PUT", path, Map.of("x-amz-checksum-crc32", "AAAAAA=="), Map.of());
String tampered = url.replace("x-amz-checksum-crc32=" + uriEncode("AAAAAA=="),
"x-amz-checksum-crc32=" + uriEncode("BBBBBB=="));
given()
.urlEncodingEnabled(false)
.body("not an empty body")
.when()
.put(tampered)
.then()
.statusCode(403)
.body(containsString("SignatureDoesNotMatch"));
}
@Test
void presignedUploadPartWithMismatchedChecksumHeaderFails() throws Exception {
createBucket();
String path = "/" + BUCKET + "/multipart-header.txt";
String uploadId = given()
.filter(LOCAL_SIGNER)
.when()
.post(path + "?uploads")
.then()
.statusCode(200)
.extract().xmlPath().getString("InitiateMultipartUploadResult.UploadId");
String url = presign("PUT", path, Map.of("uploadId", uploadId, "partNumber", "1"),
Map.of("x-amz-checksum-crc32", "AAAAAA=="));
given()
.urlEncodingEnabled(false)
.header("x-amz-checksum-crc32", "AAAAAA==")
.body("not an empty body")
.when()
.put(url)
.then()
.statusCode(400)
.body(containsString("BadDigest"));
}
@Test