FrankChen021 commented on code in PR #19609:
URL: https://github.com/apache/druid/pull/19609#discussion_r3481288018


##########
processing/src/main/java/org/apache/druid/data/input/impl/CloudObjectLocation.java:
##########
@@ -60,20 +63,37 @@ public static URI validateUriScheme(String scheme, URI uri)
   @JsonCreator
   public CloudObjectLocation(@JsonProperty("bucket") String bucket, 
@JsonProperty("path") String path)
   {
-    this.bucket = 
Preconditions.checkNotNull(StringUtils.maybeRemoveTrailingSlash(bucket),
+    this.bucket = Preconditions.checkNotNull(normalizeBucket(bucket),
                  "bucket name cannot be null. Please verify if bucket name 
adheres to naming rules");
     this.path = 
Preconditions.checkNotNull(StringUtils.maybeRemoveLeadingSlash(path));
     Preconditions.checkArgument(
-        this.bucket.equals(StringUtils.urlEncode(this.bucket)),
-        "bucket must follow DNS-compliant naming conventions"
+      this.bucket.equals(StringUtils.urlEncode(this.bucket)) || 
isS3Arn(this.bucket),
+      "bucket must follow DNS-compliant naming conventions or be a valid S3 
Access Point ARN"
+      + " or S3 Multi-Region Access Point ARN"
     );
   }
 
+  private static String normalizeBucket(String bucket)
+  {
+    String trimmed = StringUtils.maybeRemoveTrailingSlash(bucket);
+
+    if (trimmed != null && isS3Arn(trimmed)) {

Review Comment:
   [P2] Handle slash-form MRAP ARNs before URI splitting
   
   This normalization only works when the full ARN is already passed as the 
bucket string. For a URI like 
`s3://arn:aws:s3::123456789123:accesspoint/bucket.mrap/path`, `java.net.URI` 
splits the value into authority `arn:aws:s3::123456789123:accesspoint` and path 
`/bucket.mrap/path`, so the bucket passed here does not match `S3_ARN` and the 
slash-form MRAP URI remains rejected or parsed with the access point name as 
part of the key. Please normalize this form before the URI constructor splits 
bucket/path, or add validation/tests that explicitly reject it.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to