This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push: new 788c4cbca8 JAMES-4137 Upgrade S3 SDK to 2.30.x onwards 788c4cbca8 is described below commit 788c4cbca8e69b01b4c657d22b12b99e249c47db Author: Quan Tran <hqt...@linagora.com> AuthorDate: Tue Jun 10 16:42:50 2025 +0700 JAMES-4137 Upgrade S3 SDK to 2.30.x onwards --- docs/modules/servers/partials/configure/jvm.adoc | 12 +++++++++++ pom.xml | 2 +- server/blob/blob-s3/pom.xml | 2 +- .../blob/objectstorage/aws/S3ClientFactory.java | 23 +++++++++++++++++++--- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/docs/modules/servers/partials/configure/jvm.adoc b/docs/modules/servers/partials/configure/jvm.adoc index 2f645bfd80..d8200a7d80 100644 --- a/docs/modules/servers/partials/configure/jvm.adoc +++ b/docs/modules/servers/partials/configure/jvm.adoc @@ -90,6 +90,18 @@ To enable blob hierarchy compatible with MinIO add in `jvm.properties`: james.s3.minio.compatibility.mode=true ---- +== Disable S3 checksum backward compatibility + +By default, James enables backward compatibility for S3 SDK checksum mechanisms to support S3 compatible object storages which rely on MD5 checksum. This can be disabled for native AWS S3 that does not need to rely on the MD5 checksum. + +Optional. Boolean. Defaults to true. + +Ex in `jvm.properties` +---- +james.s3.sdk.checksum.backward.compatibility=false +---- +To disable S3 checksum backward compatibility. + == JMAP Quota draft compatibility Some JMAP clients depend on the JMAP Quota draft specifications. The property `james.jmap.quota.draft.compatibility` allows diff --git a/pom.xml b/pom.xml index a7f8b0cbb8..5509d511fd 100644 --- a/pom.xml +++ b/pom.xml @@ -644,7 +644,7 @@ <junit.platform.version>1.10.2</junit.platform.version> <junit.vintage.version>5.10.2</junit.vintage.version> <concurrent.version>1.3.4</concurrent.version> - <netty.version>4.1.110.Final</netty.version> + <netty.version>4.1.118.Final</netty.version> <cucumber.version>7.15.0</cucumber.version> <jackson.version>2.17.1</jackson.version> diff --git a/server/blob/blob-s3/pom.xml b/server/blob/blob-s3/pom.xml index 2b80d79dbc..e9e4a22aaf 100644 --- a/server/blob/blob-s3/pom.xml +++ b/server/blob/blob-s3/pom.xml @@ -33,7 +33,7 @@ <name>Apache James :: Server :: Blob :: S3</name> <properties> - <s3-sdk.version>2.26.5</s3-sdk.version> + <s3-sdk.version>2.31.59</s3-sdk.version> </properties> <dependencies> diff --git a/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3ClientFactory.java b/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3ClientFactory.java index 6a9ebacd90..5ea18bd128 100644 --- a/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3ClientFactory.java +++ b/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3ClientFactory.java @@ -45,9 +45,13 @@ import com.google.common.collect.ImmutableList; import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; +import software.amazon.awssdk.core.checksums.RequestChecksumCalculation; +import software.amazon.awssdk.core.checksums.ResponseChecksumValidation; import software.amazon.awssdk.http.TlsTrustManagersProvider; import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient; +import software.amazon.awssdk.services.s3.LegacyMd5Plugin; import software.amazon.awssdk.services.s3.S3AsyncClient; +import software.amazon.awssdk.services.s3.S3AsyncClientBuilder; import software.amazon.awssdk.services.s3.S3Configuration; @Singleton @@ -72,6 +76,7 @@ public class S3ClientFactory implements Startable, Closeable { public static final String S3_METRICS_ENABLED_PROPERTY_KEY = "james.s3.metrics.enabled"; public static final String S3_METRICS_ENABLED_DEFAULT_VALUE = "true"; public static final String S3_METRICS_PREFIX = System.getProperty("james.s3.metrics.prefix", DEFAULT_S3_METRICS_PREFIX); + public static final boolean S3_CHECKSUM_BACKWARD_COMPATIBILITY_ENABLED = Boolean.parseBoolean(System.getProperty("james.s3.sdk.checksum.backward.compatibility", "true")); private final S3AsyncClient s3Client; @@ -86,7 +91,11 @@ public class S3ClientFactory implements Startable, Closeable { .pathStyleAccessEnabled(true) .build(); - s3Client = S3AsyncClient.builder() + s3Client = createS3AsyncClient(configuration, jamesS3MetricPublisherProvider, authConfiguration, pathStyleAccess); + } + + private S3AsyncClient createS3AsyncClient(S3BlobStoreConfiguration configuration, Provider<JamesS3MetricPublisher> jamesS3MetricPublisherProvider, AwsS3AuthConfiguration authConfiguration, S3Configuration pathStyleAccess) { + S3AsyncClientBuilder s3AsyncClientBuilder = S3AsyncClient.builder() .credentialsProvider(StaticCredentialsProvider.create( AwsBasicCredentials.create(authConfiguration.getAccessKeyId(), authConfiguration.getSecretKey()))) .httpClientBuilder(httpClientBuilder(configuration)) @@ -98,8 +107,16 @@ public class S3ClientFactory implements Startable, Closeable { if (s3MetricsEnabled) { builder.addMetricPublisher(jamesS3MetricPublisherProvider.get()); } - }) - .build(); + }); + + if (S3_CHECKSUM_BACKWARD_COMPATIBILITY_ENABLED) { + s3AsyncClientBuilder + .addPlugin(LegacyMd5Plugin.create()) + .requestChecksumCalculation(RequestChecksumCalculation.WHEN_REQUIRED) + .responseChecksumValidation(ResponseChecksumValidation.WHEN_REQUIRED); + } + + return s3AsyncClientBuilder.build(); } private NettyNioAsyncHttpClient.Builder httpClientBuilder(S3BlobStoreConfiguration configuration) { --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org