Skip to content

Commit 6945221

Browse files
committed
Merge branch 'main' of github.com:aws/amazon-s3-encryption-client-java into transfer-manager-tests
2 parents 684bc47 + 034bb89 commit 6945221

File tree

7 files changed

+91
-19
lines changed

7 files changed

+91
-19
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## [3.3.0](https://github.com/aws/aws-s3-encryption-client-java/compare/v3.2.3...v3.3.0) (2024-10-30)
4+
5+
### Features
6+
7+
* allow configuration of instruction file client, add new top-level client options, disable wrapped multipart upload ([#387](https://github.com/aws/aws-s3-encryption-client-java/issues/387)) ([37e772f](https://github.com/aws/aws-s3-encryption-client-java/commit/37e772f06230efcae618b31767dbd4c59c54a6d4))
8+
9+
### Maintenance
10+
11+
* add ListBucket permission to release role ([#391](https://github.com/aws/aws-s3-encryption-client-java/issues/391)) ([fa1e6cc](https://github.com/aws/aws-s3-encryption-client-java/commit/fa1e6cc981c0ecfef5c5b5c8e65472beedfddf66))
12+
* **deps-dev:** bump commons-io:commons-io from 2.11.0 to 2.14.0 ([#381](https://github.com/aws/aws-s3-encryption-client-java/issues/381)) ([5e03842](https://github.com/aws/aws-s3-encryption-client-java/commit/5e038421e0757a72590aa6409932abb0f377ba9c))
13+
314
## [3.2.3](https://github.com/aws/aws-s3-encryption-client-java/compare/v3.2.2...v3.2.3) (2024-10-04)
415

516
### Fixes

cfn/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ Resources:
339339
Action:
340340
- 's3:ListBucket'
341341
Resource:
342+
- !GetAtt S3ECReleaseTestS3Bucket.Arn
342343
- !GetAtt S3ECReleaseTestS3BucketTestVectors.Arn
343344

344345
S3ECReleaseTestS3BucketAlternate:

pom.xml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>software.amazon.encryption.s3</groupId>
88
<artifactId>amazon-s3-encryption-client-java</artifactId>
9-
<version>3.2.3</version>
9+
<version>3.3.0</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Amazon S3 Encryption Client</name>
@@ -56,7 +56,7 @@
5656
<dependency>
5757
<groupId>software.amazon.awssdk</groupId>
5858
<artifactId>bom</artifactId>
59-
<version>2.28.28</version>
59+
<version>2.29.29</version>
6060
<optional>true</optional>
6161
<type>pom</type>
6262
<scope>import</scope>
@@ -68,22 +68,21 @@
6868
<dependency>
6969
<groupId>software.amazon.awssdk</groupId>
7070
<artifactId>s3</artifactId>
71-
<version>2.28.28</version>
71+
<version>2.29.29</version>
7272
</dependency>
7373

7474
<dependency>
7575
<groupId>software.amazon.awssdk</groupId>
7676
<artifactId>kms</artifactId>
77-
<version>2.28.28</version>
78-
<optional>true</optional>
77+
<version>2.29.29</version>
7978
</dependency>
8079

8180
<!-- Used when enableMultipartPutObject is configured -->
8281
<dependency>
8382
<groupId>software.amazon.awssdk.crt</groupId>
8483
<artifactId>aws-crt</artifactId>
8584
<optional>true</optional>
86-
<version>0.31.3</version>
85+
<version>0.33.5</version>
8786
</dependency>
8887

8988
<dependency>
@@ -171,7 +170,7 @@
171170
<dependency>
172171
<groupId>software.amazon.awssdk</groupId>
173172
<artifactId>sts</artifactId>
174-
<version>2.28.28</version>
173+
<version>2.29.29</version>
175174
<optional>true</optional>
176175
<scope>test</scope>
177176
</dependency>

src/main/java/software/amazon/encryption/s3/S3AsyncEncryptionClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ public Builder useArnRegion(Boolean useArnRegion) {
754754

755755
/**
756756
* Multipart via the wrapped client is currently NOT supported by the S3 Encryption Client.
757-
* Use the {@link this.enableMultipartPutObject()} option instead for high-level multipart uploads.
757+
* Use the {@link Builder#enableMultipartPutObject(boolean)} option instead for high-level multipart uploads.
758758
* Multipart downloads are currently NOT supported.
759759
*/
760760
@Override
@@ -764,7 +764,7 @@ public Builder multipartEnabled(Boolean enabled) {
764764

765765
/**
766766
* Multipart via the wrapped client is currently NOT supported by the S3 Encryption Client.
767-
* Use the {@link this.enableMultipartPutObject()} option instead for high-level multipart uploads.
767+
* Use the {@link Builder#enableMultipartPutObject(boolean)} option instead for high-level multipart uploads.
768768
* Multipart downloads are currently NOT supported.
769769
*/
770770
@Override

src/main/java/software/amazon/encryption/s3/internal/CipherAsyncRequestBody.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import org.reactivestreams.Subscriber;
66
import software.amazon.awssdk.core.async.AsyncRequestBody;
7+
import software.amazon.encryption.s3.S3EncryptionClientException;
78
import software.amazon.encryption.s3.materials.CryptographicMaterials;
89

910
import java.nio.ByteBuffer;
@@ -35,7 +36,9 @@ public CipherAsyncRequestBody(final AsyncRequestBody wrappedAsyncRequestBody, fi
3536

3637
@Override
3738
public void subscribe(Subscriber<? super ByteBuffer> subscriber) {
38-
wrappedAsyncRequestBody.subscribe(new CipherSubscriber(subscriber, contentLength().orElse(-1L), materials, iv));
39+
wrappedAsyncRequestBody.subscribe(new CipherSubscriber(subscriber,
40+
contentLength().orElseThrow(() -> new S3EncryptionClientException("Unbounded streams are currently not supported.")),
41+
materials, iv));
3942
}
4043

4144
@Override

src/main/java/software/amazon/encryption/s3/internal/PutEncryptedObjectPipeline.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public CompletableFuture<PutObjectResponse> putObject(PutObjectRequest request,
5353
contentLength = request.contentLength();
5454
}
5555
} else {
56-
contentLength = requestBody.contentLength().orElse(-1L);
56+
contentLength = requestBody.contentLength().orElseThrow(() -> new S3EncryptionClientException("Unbounded streams are currently not supported."));
5757
}
5858

5959
if (contentLength > AlgorithmSuite.ALG_AES_256_GCM_IV12_TAG16_NO_KDF.cipherMaxContentLengthBytes()) {

src/test/java/software/amazon/encryption/s3/S3EncryptionClientStreamTest.java

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@
1717
import software.amazon.awssdk.core.ResponseInputStream;
1818
import software.amazon.awssdk.core.async.AsyncRequestBody;
1919
import software.amazon.awssdk.core.async.AsyncResponseTransformer;
20+
import software.amazon.awssdk.core.async.BlockingInputStreamAsyncRequestBody;
2021
import software.amazon.awssdk.core.sync.RequestBody;
2122
import software.amazon.awssdk.services.s3.S3AsyncClient;
2223
import software.amazon.awssdk.services.s3.S3Client;
2324
import software.amazon.awssdk.services.s3.model.GetObjectResponse;
2425
import software.amazon.awssdk.services.s3.model.PutObjectRequest;
2526
import software.amazon.awssdk.services.s3.model.PutObjectResponse;
2627
import software.amazon.awssdk.utils.IoUtils;
27-
import software.amazon.encryption.s3.utils.BoundedStreamBufferer;
2828
import software.amazon.encryption.s3.utils.BoundedInputStream;
29+
import software.amazon.encryption.s3.utils.BoundedStreamBufferer;
2930
import software.amazon.encryption.s3.utils.MarkResetBoundedZerosInputStream;
3031
import software.amazon.encryption.s3.utils.S3EncryptionClientTestResources;
3132

@@ -135,6 +136,63 @@ public void ordinaryInputStreamV3Encrypt() throws IOException {
135136
v3Client.close();
136137
}
137138

139+
@Test
140+
public void ordinaryInputStreamV3UnboundedAsync() {
141+
try (S3AsyncClient s3AsyncEncryptionClient = S3AsyncEncryptionClient.builder().aesKey(AES_KEY).build()) {
142+
final String objectKey = appendTestSuffix("ordinaryInputStreamV3UnboundedAsync");
143+
BlockingInputStreamAsyncRequestBody body =
144+
AsyncRequestBody.forBlockingInputStream(null);
145+
try {
146+
s3AsyncEncryptionClient.putObject(r -> r.bucket(BUCKET).key(objectKey), body);
147+
fail("Expected exception!");
148+
} catch (S3EncryptionClientException exception) {
149+
// expected
150+
assertTrue(exception.getMessage().contains("Unbounded streams are currently not supported"));
151+
}
152+
}
153+
}
154+
155+
@Test
156+
public void ordinaryInputStreamV3UnboundedMultipartAsync() {
157+
try (S3AsyncClient s3AsyncEncryptionClient = S3AsyncEncryptionClient.builder()
158+
.aesKey(AES_KEY)
159+
.enableMultipartPutObject(true)
160+
.build()) {
161+
final String objectKey = appendTestSuffix("ordinaryInputStreamV3UnboundedAsync");
162+
BlockingInputStreamAsyncRequestBody body =
163+
AsyncRequestBody.forBlockingInputStream(null);
164+
try {
165+
s3AsyncEncryptionClient.putObject(r -> r.bucket(BUCKET).key(objectKey), body);
166+
fail("Expected exception!");
167+
} catch (S3EncryptionClientException exception) {
168+
// expected
169+
assertTrue(exception.getMessage().contains("Unbounded streams are currently not supported"));
170+
}
171+
}
172+
}
173+
174+
@Test
175+
public void ordinaryInputStreamV3UnboundedCrt() {
176+
try (S3AsyncClient s3CrtAsyncClient = S3AsyncClient.crtCreate()) {
177+
try (S3AsyncClient s3AsyncEncryptionClient = S3AsyncEncryptionClient.builder()
178+
.aesKey(AES_KEY)
179+
.enableMultipartPutObject(true)
180+
.wrappedClient(s3CrtAsyncClient)
181+
.build()) {
182+
final String objectKey = appendTestSuffix("ordinaryInputStreamV3UnboundedCrt");
183+
BlockingInputStreamAsyncRequestBody body =
184+
AsyncRequestBody.forBlockingInputStream(null);
185+
try {
186+
s3AsyncEncryptionClient.putObject(r -> r.bucket(BUCKET).key(objectKey), body);
187+
fail("Expected exception!");
188+
} catch (S3EncryptionClientException exception) {
189+
// expected
190+
assertTrue(exception.getMessage().contains("Unbounded streams are currently not supported"));
191+
}
192+
}
193+
}
194+
}
195+
138196
@Test
139197
public void ordinaryInputStreamV3Decrypt() throws IOException {
140198
final String objectKey = appendTestSuffix("ordinaryInputStreamV3Decrypt");
@@ -274,9 +332,9 @@ public void customSetBufferSizeWithLargeObject() throws IOException {
274332
final long fileSizeExceedingDefaultLimit = 1024 * 1024 * 32 + 1;
275333
final InputStream largeObjectStream = new BoundedInputStream(fileSizeExceedingDefaultLimit);
276334
v3ClientWithBuffer32MiB.putObject(PutObjectRequest.builder()
277-
.bucket(BUCKET)
278-
.key(objectKey)
279-
.build(), RequestBody.fromInputStream(largeObjectStream, fileSizeExceedingDefaultLimit));
335+
.bucket(BUCKET)
336+
.key(objectKey)
337+
.build(), RequestBody.fromInputStream(largeObjectStream, fileSizeExceedingDefaultLimit));
280338

281339
largeObjectStream.close();
282340

@@ -327,9 +385,9 @@ public void customSetBufferSizeWithLargeObjectAsyncClient() throws IOException {
327385
final InputStream largeObjectStream = new BoundedInputStream(fileSizeExceedingDefaultLimit);
328386
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
329387
CompletableFuture<PutObjectResponse> futurePut = v3ClientWithBuffer32MiB.putObject(PutObjectRequest.builder()
330-
.bucket(BUCKET)
331-
.key(objectKey)
332-
.build(), AsyncRequestBody.fromInputStream(largeObjectStream, fileSizeExceedingDefaultLimit, singleThreadExecutor));
388+
.bucket(BUCKET)
389+
.key(objectKey)
390+
.build(), AsyncRequestBody.fromInputStream(largeObjectStream, fileSizeExceedingDefaultLimit, singleThreadExecutor));
333391

334392
futurePut.join();
335393
largeObjectStream.close();
@@ -387,7 +445,7 @@ public void delayedAuthModeWithLargeObject() throws IOException {
387445
assertThrows(S3EncryptionClientException.class, () -> v3Client.getObjectAsBytes(builder -> builder
388446
.bucket(BUCKET)
389447
.key(objectKey)));
390-
448+
391449
S3Client v3ClientWithDelayedAuth = S3EncryptionClient.builder()
392450
.aesKey(AES_KEY)
393451
.enableDelayedAuthenticationMode(true)

0 commit comments

Comments
 (0)