Gabriel39 commented on code in PR #71205:
URL: https://github.com/apache/doris/pull/71205#discussion_r4789223977


##########
fe/fe-connector/fe-connector-fluss/src/main/java/org/apache/doris/connector/fluss/FlussConnectorProvider.java:
##########
@@ -51,16 +56,96 @@ public Connector create(Map<String, String> properties, 
ConnectorContext context
     }
 
     /**
-     * The fluss client's SASL credentials, a small and stable set of keys, 
and the lake options under
-     * {@link FlussCatalogProperties#LAKE_OPTION_PREFIX}: those are open-ended 
(new paimon / filesystem
+     * The fluss client's SASL and direct gateway REST credentials use stable 
keys. Lake options under
+     * {@link FlussCatalogProperties#LAKE_OPTION_PREFIX} are open-ended (new 
paimon / filesystem
      * credential names may arrive without a Doris release), so a lake option 
is a secret when its name
      * carries a credential-like word, and endpoints and other operational 
settings stay visible.
      */
     @Override
     public ConnectorSecuritySurface securitySurface() {
+        return 
baseSecuritySurface().withSsrfEndpointPrefixes(FlussCatalogProperties.LAKE_OPTION_PREFIX);
+    }
+
+    private static ConnectorSecuritySurface baseSecuritySurface() {
         return 
ConnectorSecuritySurface.ofSensitiveKeys("fluss.client.security.sasl.username",
                         "fluss.client.security.sasl.password", 
"fluss.client.security.sasl.jaas.config")
+                // Direct gateway REST options reach the sibling through a 
separate namespace on first lake access.
+                .withSsrfEndpointPrefixes("paimon.rest.")

Review Comment:
   Fixed in ec33088ab4. Admission and Paimon sibling normalization now share 
the same direct-then-nested REST option selection. The selected nested override 
retires the direct metadata route; clearing it reactivates that route, while 
independent storage projections are retained. Tests cover all three nested URI 
spellings and the SQL replacement/blank-activation sequence with a successful 
same-policy followup. The fresh standard FE selection (157 classes / 2741 
tests), Checkstyle, FE packaging and both local SQL suites passed.



##########
fe/fe-filesystem/fe-filesystem-api/src/main/java/org/apache/doris/filesystem/properties/StorageEndpointProperties.java:
##########
@@ -0,0 +1,263 @@
+// 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.apache.doris.filesystem.properties;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Predicate;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/** Network endpoint aliases consumed by filesystem providers and their 
authentication clients. */
+public final class StorageEndpointProperties {
+    private static final List<String> PAIMON_STORAGE_PREFIXES = List.of(
+            "paimon.s3.", "paimon.s3a.", "paimon.fs.s3.", "paimon.fs.oss.");
+    private static final List<String> S3_REGION_ALIASES = List.of("s3.region", 
"AWS_REGION", "region", "REGION",
+            "aws.region", "glue.region", "aws.glue.region", 
"iceberg.rest.signing-region", "rest.signing-region",
+            "client.region");
+    private static final List<String> S3_ENDPOINT_ALIASES = 
List.of("s3.endpoint", "AWS_ENDPOINT", "endpoint",
+            "ENDPOINT", "aws.endpoint", "glue.endpoint", "aws.glue.endpoint");
+    private static final Pattern[] S3_ENDPOINT_PATTERNS = new Pattern[] {
+            Pattern.compile(
+                    "^(?:https?://)?(?:"
+                            + 
"s3(?:[-.]fips)?(?:[-.]dualstack)?[-.]([a-z0-9-]+)|"
+                            + "s3express-control\\.([a-z0-9-]+)|"
+                            + "s3express-[a-z0-9-]+\\.([a-z0-9-]+)"
+                            + ")\\.amazonaws\\.com(?:/.*)?$",
+                    Pattern.CASE_INSENSITIVE),
+            Pattern.compile(
+                    
"^(?:https?://)?glue(?:-fips)?\\.([a-z0-9-]+)\\.(amazonaws\\.com(?:\\.cn)?|api\\.aws)$",
+                    Pattern.CASE_INSENSITIVE)
+    };
+
+    private StorageEndpointProperties() {
+    }
+
+    public static Map<String, List<String>> derivedEndpointValues(Map<String, 
String> properties) {
+        Map<String, List<String>> result = new 
LinkedHashMap<>(derivedS3EndpointValues(properties));
+        OssEndpointProperties.derivedEndpointValues(properties).forEach((key, 
values) ->
+                result.merge(key, values, (existing, added) -> {
+                    List<String> combined = new ArrayList<>(existing);
+                    combined.addAll(added);
+                    return combined;
+                }));
+        return result;
+    }
+
+    public static boolean hasExplicitFilesystem(Map<String, String> 
properties) {
+        return "true".equalsIgnoreCase(properties.get("oss.hdfs.enabled"))
+                || properties.entrySet().stream().anyMatch(entry -> 
entry.getKey() != null
+                        && entry.getKey().startsWith("fs.") && 
entry.getKey().endsWith(".support")
+                        && "true".equalsIgnoreCase(entry.getValue()));
+    }
+
+    private static Map<String, List<String>> 
derivedS3EndpointValues(Map<String, String> properties) {
+        // An explicit non-S3 provider disables the registry's S3 guess, 
including shared region aliases.
+        if (hasExplicitFilesystem(properties) && 
!Boolean.parseBoolean(properties.get("fs.s3.support"))) {
+            return Map.of();
+        }
+        String regionKey = firstNonblankKey(properties, S3_REGION_ALIASES);

Review Comment:
   Fixed in ec33088ab4. The filesystem API now owns the pure GCS selection 
signals used by binding and admission. An inferred GCS route no longer derives 
the unused AWS regional peer; an explicit S3 request reactivates that check. 
Recording, helper and SQL tests cover both sides. Shared helper signatures are 
recorded in both plugin API baselines, with matching connector/filesystem major 
versions and host-provided dependency scope. The fresh standard FE selection 
(157 classes / 2741 tests), Checkstyle, FE packaging and both local SQL suites 
passed.



##########
fe/fe-core/src/main/java/org/apache/doris/connector/CatalogEndpointSecurity.java:
##########
@@ -0,0 +1,420 @@
+// 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.apache.doris.connector;
+
+import org.apache.doris.cloud.security.SecurityChecker;
+import org.apache.doris.common.DdlException;
+import org.apache.doris.common.util.DatasourcePrintableMap;
+import org.apache.doris.common.util.DebugPointUtil;
+import org.apache.doris.common.util.DebugPointUtil.DebugPoint;
+import org.apache.doris.connector.spi.ConnectorSecuritySurface;
+import org.apache.doris.filesystem.properties.HdfsEndpointProperties;
+import org.apache.doris.filesystem.properties.StorageEndpointProperties;
+
+import com.google.common.net.HostAndPort;
+import com.google.common.net.InetAddresses;
+import okhttp3.HttpUrl;
+
+import java.net.IDN;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/** Shared endpoint admission for root and indirectly created catalog 
connectors. */
+public final class CatalogEndpointSecurity {
+    private static final String REJECT_HOST_POINT = 
"CatalogEndpointSecurity.reject_host";
+
+    private CatalogEndpointSecurity() {
+    }
+
+    public static boolean isEnabled() {
+        return SecurityChecker.getInstance().isEnabled() || 
DebugPointUtil.isEnable(REJECT_HOST_POINT);

Review Comment:
   Fixed in ec33088ab4. CatalogEndpointSecurity.isEnabled now uses a 
non-consuming availability check. The actual admission decision retains the 
single execution, and expiry/exhaustion removes only the same debug-point 
instance. Tests cover repeated availability checks, execute=1, expiry and 
globally disabled points, including an exact-peer CREATE refusal with execute=1 
in the SQL suite. The fresh standard FE selection (157 classes / 2741 tests), 
Checkstyle, FE packaging and both local SQL suites passed.



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