gnodet-bot commented on code in PR #2290:
URL: https://github.com/apache/maven-resolver/pull/2290#discussion_r4720401301


##########
maven-resolver-transport-s3/src/main/java/org/eclipse/aether/transport/s3/S3TransporterConfigurationKeys.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.eclipse.aether.transport.s3;
+
+import org.eclipse.aether.ConfigurationProperties;
+import org.eclipse.aether.RepositorySystemSession;
+import 
org.eclipse.aether.transport.s3.internal.FixedBucketObjectNameMapperFactory;
+
+/**
+ * Configuration for the S3 transport.
+ *
+ * @since 2.0.27
+ */
+public final class S3TransporterConfigurationKeys {
+    private S3TransporterConfigurationKeys() {}
+
+    static final String CONFIG_PROPS_PREFIX =
+            ConfigurationProperties.PREFIX_TRANSPORT + 
S3TransporterFactory.NAME + ".";
+
+    /**
+     * The prefix of the MinIO transport's keys. The keys below that have a 
MinIO counterpart are also read under this
+     * prefix, so that a repository configured for the MinIO transport works 
with this one unchanged.
+     */
+    static final String LEGACY_CONFIG_PROPS_PREFIX = 
ConfigurationProperties.PREFIX_TRANSPORT + "minio.";
+
+    /**
+     * Object name mapper to use. Also read under the MinIO transport's key, 
{@code aether.transport.minio.objectNameMapper}.
+     *
+     * @configurationSource {@link 
RepositorySystemSession#getConfigProperties()}
+     * @configurationType {@link String}
+     * @configurationDefaultValue {@link #DEFAULT_OBJECT_NAME_MAPPER}
+     * @configurationRepoIdSuffix Yes
+     */
+    public static final String CONFIG_PROP_OBJECT_NAME_MAPPER = 
CONFIG_PROPS_PREFIX + "objectNameMapper";
+
+    static final String LEGACY_CONFIG_PROP_OBJECT_NAME_MAPPER = 
LEGACY_CONFIG_PROPS_PREFIX + "objectNameMapper";
+
+    public static final String DEFAULT_OBJECT_NAME_MAPPER = 
FixedBucketObjectNameMapperFactory.NAME;
+
+    /**
+     * The fixed bucket name to use. Also read under the MinIO transport's 
key, {@code aether.transport.minio.fixedBucketName}.
+     *
+     * @configurationSource {@link 
RepositorySystemSession#getConfigProperties()}
+     * @configurationType {@link String}
+     * @configurationDefaultValue {@link #DEFAULT_FIXED_BUCKET_NAME}
+     * @configurationRepoIdSuffix Yes
+     */
+    public static final String CONFIG_PROP_FIXED_BUCKET_NAME = 
CONFIG_PROPS_PREFIX + "fixedBucketName";
+
+    public static final String LEGACY_CONFIG_PROP_FIXED_BUCKET_NAME = 
LEGACY_CONFIG_PROPS_PREFIX + "fixedBucketName";
+
+    public static final String DEFAULT_FIXED_BUCKET_NAME = "maven";
+
+    /**
+     * The AWS region the requests are signed for. S3-compatible stores accept 
any value, but Signature Version 4
+     * needs one. When unset, the SDK's default region provider chain is 
consulted (environment, system properties,
+     * profile), and {@link #DEFAULT_REGION} is used if that chain yields 
nothing.

Review Comment:
   ⚠️ **Misleading Javadoc — the region lookup is a subset of the SDK's default 
chain**
   
   This says "the SDK's default region provider chain is consulted" but 
`S3Transporter.region()` deliberately uses a **restricted** chain 
(`SystemSettingsRegionProvider` + `AwsProfileRegionProvider` only). 
`DefaultAwsRegionProviderChain` additionally includes 
`InstanceProfileRegionProvider`, `ContainerMetadataRegionProvider`, and others 
— the very sources that ECS/EKS/Lambda users expect to supply the region 
automatically.
   
   The result: a user running in ECS/EKS/Lambda who omits 
`aether.transport.s3.region` and has no system properties or profile file will 
read this Javadoc, conclude the SDK's default chain will detect their region, 
and silently get `us-east-1` instead. The asymmetry makes this worse: 
`credentialsProvider()` does use the full SDK chain (including IRSA/container 
credentials), so credentials succeed while the region is wrong — a confusing 
failure mode.
   
   The inline comment in the method body is accurate; the public Javadoc is not.
   
   ```suggestion
        * The AWS region the requests are signed for. S3-compatible stores 
accept any value, but Signature Version 4
        * needs one. When unset, region is resolved from environment variables, 
system properties, and the AWS profile
        * (but not from EC2/ECS/EKS instance metadata, to avoid stalling 
outside AWS); {@link #DEFAULT_REGION} is used if none of those sources yields a 
value.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to