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


##########
fe/fe-connector/fe-connector-maxcompute/src/main/java/org/apache/doris/connector/maxcompute/MaxComputeConnectorProvider.java:
##########
@@ -97,6 +97,8 @@ public ConnectorSecuritySurface securitySurface() {
         Set<String> sensitiveKeys = 
ConnectorPropertiesUtils.getSensitiveKeys(MCCatalogProperties.class);
         // Retained token properties must stay masked even though the current 
authentication binder ignores them.
         sensitiveKeys.add("mc.session_token");
-        return ConnectorSecuritySurface.EMPTY.withSensitiveKeys(sensitiveKeys);
+        return ConnectorSecuritySurface.EMPTY.withSensitiveKeys(sensitiveKeys)
+                .withSsrfEndpoints(MCCatalogProperties.ENDPOINT, 
MCCatalogProperties.ODPS_ENDPOINT,

Review Comment:
   Addressed in ed62825c9aa. Admission and runtime now share a pure MaxCompute 
endpoint resolver: canonical endpoint, converted legacy tunnel service 
endpoint, ODPS endpoint, then region fallback. Inactive aliases are excluded 
while the actual derived ODPS/Storage service peer is checked. Tests 
distinguish canonical precedence and tunnel/region-only lazy reconstruction.
   
   Validation: 137 selected test classes / 2460 tests passed; FE Checkstyle and 
packaging checks passed. The SQL suite passed 376 expected policy refusals with 
positive CREATE/ALTER controls.



##########
fe/fe-connector/fe-connector-paimon/src/main/java/org/apache/doris/connector/paimon/PaimonConnectorProvider.java:
##########
@@ -106,7 +110,61 @@ public ConnectorSecuritySurface securitySurface() {
         // The secrets are those of every metastore flavor: the engine masks 
by key name alone.
         return ConnectorSecuritySurface.ofJdbcDriverUrls(
                 "paimon.catalog.type", "paimon.jdbc.driver_url", 
"jdbc.driver_url")
-                .withSensitiveKeys(MetaStoreProviders.sensitivePropertyKeys());
+                .withSensitiveKeys(MetaStoreProviders.sensitivePropertyKeys())
+                
.withSensitiveKeys(JdbcTlsStoreUrlSecurity.sensitivePropertyKeys("jdbc."))
+                
.withSensitiveKeys(JdbcTlsStoreUrlSecurity.sensitivePropertyKeys("paimon.jdbc."))
+                // The pass-through bearer token is opaque even when its bytes 
look like an HTTP URL.
+                .withSensitiveKeys("paimon.rest.token")
+                // REST token providers also perform HTTP calls; checking only 
the catalog URI misses them.
+                .withSsrfEndpoints("paimon.rest.uri", "uri", 
"paimon.rest.dlf.token-ecs-metadata-url",
+                        "hive.metastore.uris", "metastore.thrift.uris", 
"paimon.jdbc.uri")
+                .withSsrfEndpoints("paimon.rest.dlf.oss-endpoint", 
"dlf.endpoint", "dlf.catalog.endpoint")

Review Comment:
   Addressed in ed62825c9aa. Both Paimon DLF endpoint aliases now default to 
HTTPS port 443, matching the shared holder and DLF proxy. Recording 
CREATE/ALTER coverage includes bare hostnames and preserves the independent 
storage interpretation of aliases.
   
   Validation: 137 selected test classes / 2460 tests passed; FE Checkstyle and 
packaging checks passed. The SQL suite passed 376 expected policy refusals with 
positive CREATE/ALTER controls.



##########
fe/fe-connector/fe-connector-fluss/src/main/java/org/apache/doris/connector/fluss/FlussConnectorProvider.java:
##########
@@ -51,16 +56,79 @@ 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.")
+                .withSensitiveKeys("paimon.rest.token", 
"paimon.rest.dlf.access-key-id",
+                        "paimon.rest.dlf.access-key-secret")
+                .withSsrfEndpoints(FlussCatalogProperties.BOOTSTRAP_SERVERS)
+                .withSsrfEndpoints(FlussCatalogProperties.LAKE_OPTION_PREFIX + 
"hive.metastore.uris",
+                        FlussCatalogProperties.LAKE_OPTION_PREFIX + 
"metastore.thrift.uris")
                 
.withSensitiveKeyPrefix(FlussCatalogProperties.LAKE_OPTION_PREFIX,
                         "key", "secret", "password", "token", "credential");
     }
+
+    @Override
+    public ConnectorSecuritySurface securitySurface(Map<String, String> 
properties) {
+        ConnectorSecuritySurface base = baseSecuritySurface();
+        ConnectorSecuritySurface surface = base;
+        Map<String, String> lake = 
FlussCatalogProperties.extractLakeOverrides(properties);
+        Map<String, String> context = new HashMap<>(properties);
+        context.putAll(lake);
+        // The storage sibling binds canonical names after translating Hadoop 
lake aliases.
+        Map<String, String> storage = 
LakeStorageOptions.toStorageProperties(lake);
+        context.putAll(storage);

Review Comment:
   Addressed in ed62825c9aa. Fluss storage projection now follows runtime 
precedence: direct catalog keys, translated lake defaults, then unmapped 
sibling fallbacks. Direct blank keys remain authoritative. Tests cover 
conflicting direct/nested regions and an unmapped alias that previously hid a 
translated storage peer; SQL verifies rejection and same-policy accepted 
follow-ups.
   
   Validation: 137 selected test classes / 2460 tests passed; FE Checkstyle and 
packaging checks passed. The SQL suite passed 376 expected policy refusals with 
positive CREATE/ALTER controls.



##########
fe/fe-filesystem/fe-filesystem-api/src/main/java/org/apache/doris/filesystem/properties/StorageEndpointProperties.java:
##########
@@ -0,0 +1,225 @@
+// 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.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) {
+        String regionKey = firstNonblankKey(properties, S3_REGION_ALIASES);
+        String endpointKey = firstNonblankKey(properties, S3_ENDPOINT_ALIASES);
+        String sourceKey = endpointKey;
+        String endpoint = endpointKey == null ? null : 
properties.get(endpointKey).trim();
+        if (regionKey == null && endpointKey == null) {
+            // The binder's legacy URI fallback runs on its HashMap snapshot, 
including URI key aliases.
+            Map<String, String> raw = new HashMap<>(properties);
+            sourceKey = raw.keySet().stream().filter(key -> 
key.equalsIgnoreCase("uri")).findFirst().orElse(null);
+            if (sourceKey == null) {
+                return Map.of();
+            }
+            String pathKey = firstNonblankKey(properties, 
List.of("use_path_style", "s3.path-style-access"));
+            String forceKey = firstNonblankKey(properties, 
List.of("force_parsing_by_standard_uri"));
+            endpoint = LegacyS3Uri.deriveEndpointQuietly(raw,
+                    pathKey == null ? "false" : properties.get(pathKey).trim(),
+                    forceKey == null ? "false" : 
properties.get(forceKey).trim());
+        }
+        if (endpoint != null && 
!endpoint.toLowerCase(Locale.ROOT).contains("glue")) {

Review Comment:
   Addressed in ed62825c9aa. Ordinary legacy S3 URI-derived endpoints now enter 
storage admission with the effective HTTPS transport, using the shared legacy 
URI parser. The metadata and storage meanings of uri are projected separately. 
Coverage includes forced-standard and ordinary resource forms, case-insensitive 
URI keys, canonical endpoint suppression, CREATE and ALTER.
   
   Validation: 137 selected test classes / 2460 tests passed; FE Checkstyle and 
packaging checks passed. The SQL suite passed 376 expected policy refusals with 
positive CREATE/ALTER controls.



##########
fe/fe-filesystem/fe-filesystem-api/src/main/java/org/apache/doris/filesystem/properties/StorageEndpointProperties.java:
##########
@@ -0,0 +1,225 @@
+// 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.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) {

Review Comment:
   Addressed in ed62825c9aa. Native OSS binding and admission now share pure 
region inference and endpoint normalization, including standard/custom DLF 
aliases, custom OSS endpoints with explicit region, region-only defaults and 
legacy resource URIs. Provider selection follows explicit/guess precedence and 
OSS-HDFS suppression. The pinned native OSS SDK defaults bare authorities to 
HTTP, so the actual port 80 peer is checked. DLF-derived OSS-HDFS routes fail 
closed under enforcement until an explicit storage endpoint supplies a modeled 
transport. Recording and SQL tests distinguish metadata and storage peers and 
cover rejected ALTER retention.
   
   Validation: 137 selected test classes / 2460 tests passed; FE Checkstyle and 
packaging checks passed. The SQL suite passed 376 expected policy refusals with 
positive CREATE/ALTER controls.



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