This is an automated email from the ASF dual-hosted git repository.
oscerd pushed a commit to branch camel-4.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.14.x by this push:
new 8eea231422e1 CAMEL-21314: camel-aws2-s3 - supply the customer key when
copying SSE-C objects (camel-4.14.x backport) (#25045)
8eea231422e1 is described below
commit 8eea231422e14b9421208857cb856135f91f283e
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Jul 23 11:01:44 2026 +0200
CAMEL-21314: camel-aws2-s3 - supply the customer key when copying SSE-C
objects (camel-4.14.x backport) (#25045)
Backport of #25027 to camel-4.14.x. Also sets
copySourceSSECustomerKey/MD5/Algorithm on copyObject and re-enables
S3CopyObjectCustomerKeyIT (verified against localstack).
Co-authored-by: Claude Fable 5 <[email protected]>
---
.../main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java | 5 +++++
.../component/aws2/s3/integration/S3CopyObjectCustomerKeyIT.java | 2 --
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git
a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
index f88069c78d9b..71e8797612a1 100644
---
a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
+++
b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
@@ -451,13 +451,18 @@ public class AWS2S3Producer extends DefaultProducer {
}
if (getConfiguration().isUseCustomerKey()) {
+ // the source object was stored with SSE-C, so the same
customer key must also be supplied as the
+ // copy-source key, otherwise S3 cannot decrypt the source and
rejects the copy
if
(ObjectHelper.isNotEmpty(getConfiguration().getCustomerKeyId())) {
+
copyObjectRequest.copySourceSSECustomerKey(getConfiguration().getCustomerKeyId());
copyObjectRequest.sseCustomerKey(getConfiguration().getCustomerKeyId());
}
if
(ObjectHelper.isNotEmpty(getConfiguration().getCustomerKeyMD5())) {
+
copyObjectRequest.copySourceSSECustomerKeyMD5(getConfiguration().getCustomerKeyMD5());
copyObjectRequest.sseCustomerKeyMD5(getConfiguration().getCustomerKeyMD5());
}
if
(ObjectHelper.isNotEmpty(getConfiguration().getCustomerAlgorithm())) {
+
copyObjectRequest.copySourceSSECustomerAlgorithm(getConfiguration().getCustomerAlgorithm());
copyObjectRequest.sseCustomerAlgorithm(getConfiguration().getCustomerAlgorithm());
}
}
diff --git
a/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyIT.java
b/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyIT.java
index 182f53d3dff5..49f140244d34 100644
---
a/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyIT.java
+++
b/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectCustomerKeyIT.java
@@ -32,7 +32,6 @@ import org.apache.camel.component.aws2.s3.AWS2S3Constants;
import org.apache.camel.component.aws2.s3.AWS2S3Operations;
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.services.s3.model.GetObjectRequest;
import software.amazon.awssdk.utils.Md5Utils;
@@ -41,7 +40,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import static
software.amazon.awssdk.services.s3.model.ServerSideEncryption.AES256;
-@Disabled("Broken test")
public class S3CopyObjectCustomerKeyIT extends Aws2S3Base {
byte[] secretKey = generateSecretKey();