danielcweeks commented on code in PR #17457:
URL: https://github.com/apache/iceberg/pull/17457#discussion_r3917067820


##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIOProperties.java:
##########
@@ -853,6 +873,38 @@ public String endpoint() {
     return this.endpoint;
   }
 
+  public Set<String> presignedReadAllowedHosts() {
+    return presignedReadAllowedHosts;
+  }
+
+  private static Set<String> parsePresignedReadAllowedHosts(
+      Map<String, String> properties, String endpoint) {
+    Set<String> hosts = Sets.newHashSet();
+    String configured = properties.get(PRESIGNED_READ_ALLOWED_HOSTS);
+    if (configured == null || configured.trim().isEmpty()) {
+      hosts.addAll(PRESIGNED_READ_ALLOWED_HOSTS_DEFAULT);
+    } else {
+      for (String suffix : 
Splitter.on(',').trimResults().omitEmptyStrings().split(configured)) {
+        hosts.add(suffix.toLowerCase(Locale.ROOT));
+      }
+    }
+
+    // Always trust the configured S3 endpoint host, so custom, VPC, or 
S3-compatible endpoints
+    // work without extra configuration.
+    if (endpoint != null) {
+      try {
+        String endpointHost = URI.create(endpoint).getHost();
+        if (endpointHost != null) {
+          hosts.add(endpointHost.toLowerCase(Locale.ROOT));
+        }
+      } catch (IllegalArgumentException e) {
+        // An unparseable endpoint is validated elsewhere; ignore it for host 
allow-listing.
+      }
+    }
+
+    return hosts;
+  }
+

Review Comment:
   This isn't necessary and we should remove 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