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


##########
fe/fe-filesystem/fe-filesystem-api/src/main/java/org/apache/doris/filesystem/properties/StorageEndpointProperties.java:
##########
@@ -0,0 +1,353 @@
+// 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 List<String> GCS_ENDPOINT_ALIASES = List.of(
+            "gs.endpoint", "s3.endpoint", "AWS_ENDPOINT", "endpoint", 
"ENDPOINT");
+    private static final List<String> S3_GUESS_REGION_ALIASES = 
List.of("s3.region", "glue.region",
+            "aws.glue.region", "iceberg.rest.signing-region", 
"rest.signing-region", "client.region");
+    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));
+        // One alias can bind several selected clients; a normalized OSS peer 
must not replace S3/GCS's peer.
+        for (Map<String, List<String>> endpoints : List.of(
+                derivedGcsEndpointValues(properties), 
OssEndpointProperties.derivedEndpointValues(properties))) {
+            endpoints.forEach((key, values) -> result.merge(key, values, 
(existing, added) -> {
+                List<String> combined = new ArrayList<>(existing);
+                combined.addAll(added);
+                return combined;
+            }));
+        }
+        return result;
+    }
+
+    private static Map<String, List<String>> 
derivedGcsEndpointValues(Map<String, String> properties) {
+        String key = usesGcs(properties) ? firstNonblankKey(properties, 
GCS_ENDPOINT_ALIASES) : null;
+        if (key == null) {
+            return Map.of();
+        }
+        String endpoint = properties.get(key).trim();
+        return Map.of(key, List.of(endpoint.contains("://") ? endpoint : 
"https://"; + endpoint));
+    }
+
+    private static boolean usesS3(Map<String, String> properties) {
+        return "true".equalsIgnoreCase(properties.get("fs.s3.support"))
+                || (!hasExplicitFilesystem(properties) && 
matchesS3Guess(properties));
+    }
+
+    private static boolean usesGcs(Map<String, String> properties) {
+        return "true".equalsIgnoreCase(properties.get("fs.gcs.support"))
+                || (!hasExplicitFilesystem(properties) && 
!GcsEndpointProperties.hasExplicitS3Request(properties)
+                && GcsEndpointProperties.guessIsGcs(properties));
+    }
+
+    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) {
+        // Region binding alone does not select S3: native OSS also accepts 
legacy AWS region aliases.
+        if (!usesS3(properties)) {
+            return Map.of();
+        }
+        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 (endpointKey == null && regionKey == null && endpoint != null
+                && !endpoint.toLowerCase(Locale.ROOT).contains("glue")) {
+            // Ordinary legacy resource URIs also bind an endpoint; 
S3ObjStorage supplies HTTPS to bare authorities.
+            return s3RegionFromEndpoint(endpoint).isPresent()
+                    ? Map.of(sourceKey, List.of("https://"; + endpoint)) : 
Map.of();
+        }
+        if (endpoint != null && 
!endpoint.toLowerCase(Locale.ROOT).contains("glue")) {
+            // Ordinary explicit endpoints remain active even if another 
provider rewrites this same alias.
+            return Map.of(endpointKey, List.of(endpoint.contains("://") ? 
endpoint : "https://"; + endpoint));
+        }
+        // Glue normalization infers a missing region before rewriting the S3 
endpoint. Reuse the
+        // storage binder's inference and retain the original peer for callers 
that also contact Glue.
+        String region = regionKey == null
+                ? (endpoint == null ? "" : 
s3RegionFromEndpoint(endpoint).orElse(""))
+                : properties.get(regionKey).trim();
+        if (region.isEmpty()) {
+            return Map.of();
+        }
+        if (!region.matches("[A-Za-z0-9-]+")) {
+            throw new IllegalArgumentException("S3 region must be a literal 
hostname component");
+        }
+        String serviceEndpoint = s3EndpointForRegion(region);
+        if (regionKey != null) {
+            return Map.of(regionKey, List.of(serviceEndpoint));
+        }
+        String source = properties.get(sourceKey);
+        String normalized = source.trim().toLowerCase(Locale.ROOT);
+        // An S3 URI is a resource locator; its rewritten endpoint is the 
socket peer. An HTTP URI
+        // can also name the catalog service, so retain that independently 
checked original peer.
+        boolean originalPeer = endpointKey != null || 
normalized.startsWith("http://";)
+                || normalized.startsWith("https://";);
+        return Map.of(sourceKey, originalPeer ? List.of(source, 
serviceEndpoint) : List.of(serviceEndpoint));
+    }
+
+    /** Raw provider guessing shared with binding; first-non-null alias and 
URI precedence are significant. */
+    public static boolean matchesS3Guess(Map<String, String> properties) {
+        if (GcsEndpointProperties.hasExplicitS3Request(properties)) {
+            return true;
+        }
+        if (GcsEndpointProperties.guessIsGcs(properties)) {
+            return false;
+        }
+        String endpoint = null;
+        for (String key : S3_ENDPOINT_ALIASES) {
+            String value = properties.get(key);
+            if (value != null) {
+                endpoint = value;
+                break;
+            }
+        }
+        if (endpoint != null && !endpoint.isBlank()) {
+            return endpoint.contains("amazonaws.com");
+        }
+        for (Map.Entry<String, String> entry : properties.entrySet()) {
+            if ("uri".equalsIgnoreCase(entry.getKey()) && entry.getValue() != 
null) {
+                return entry.getValue().contains("amazonaws.com");
+            }
+        }
+        for (String key : S3_GUESS_REGION_ALIASES) {
+            String value = properties.get(key);
+            if (value != null && !value.isBlank()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static String s3EndpointForRegion(String region) {
+        return "https://s3."; + region + ".amazonaws.com";
+    }
+
+    public static Optional<String> s3RegionFromEndpoint(String endpoint) {
+        String lowerEndpoint = endpoint.toLowerCase(Locale.ROOT);
+        for (Pattern pattern : S3_ENDPOINT_PATTERNS) {
+            Matcher matcher = pattern.matcher(lowerEndpoint);
+            if (matcher.matches()) {
+                for (int i = 1; i <= matcher.groupCount(); i++) {
+                    String group = matcher.group(i);
+                    if (group != null && !group.isBlank()) {
+                        return Optional.of(group);
+                    }
+                }
+            }
+        }
+        return Optional.empty();
+    }
+
+    private static String firstNonblankKey(Map<String, String> properties, 
List<String> aliases) {
+        for (String key : aliases) {
+            String value = properties.get(key);
+            // Match the String binder: trim-empty control bytes must not 
retire a live fallback alias.
+            if (value != null && !value.trim().isEmpty()) {
+                return key;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Selected S3/GCS clients supply HTTPS; other shared aliases require an 
explicit scheme or port.
+     * @throws IllegalArgumentException if a proxy route cannot be established 
from independent endpoint values
+     */
+    public static Map<String, Integer> endpoints(Map<String, String> 
properties, Predicate<String> opaqueCredential) {
+        Map<String, Integer> endpoints = new LinkedHashMap<>();
+        // OSS-HDFS prefers its specific alias over oss.endpoint before 
emitting fs.oss.endpoint.
+        for (String key : new String[] {"s3.endpoint", "AWS_ENDPOINT", 
"endpoint", "ENDPOINT", "aws.endpoint",
+                "glue.endpoint", "aws.glue.endpoint", "oss.endpoint", 
"oss.hdfs.endpoint", "OSS_ENDPOINT",
+                "fs.oss.endpoint", "cos.endpoint", "COS_ENDPOINT",
+                "obs.endpoint", "OBS_ENDPOINT", "azure.endpoint", 
"AZURE_ENDPOINT", "azure.oauth2_server_uri",
+                "azure.oauth2_account_host", "gs.endpoint", "minio.endpoint", 
"ozone.endpoint", "fs.s3a.endpoint",
+                "fs.gs.proxy.address"}) {
+            if (properties.containsKey(key)) {
+                endpoints.put(key, -1);

Review Comment:
   Fixed in 04aeca14e2ca070bbe9f7ed09a899ea7b67b0419.
   
   Typed S3/GCS endpoint admission now retains only aliases selected by the 
modeled storage consumers. A saved fallback remains dormant until clearing the 
preferred alias. Selected native OSS peers are retained, and independent Glue 
metadata and raw Hadoop routes stay checked. Ten routing cases and ten SQL 
activation/retention sequences cover the S3/GCS alias families; separate 
controls keep metadata and Hadoop peers active.
   
   The current head passed 2954 FE tests, strict FE Checkstyle, a fresh FE 
build, and both local SQL suites. Scope and verification limits are recorded in 
the PR description.



##########
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() {
+        // The admission decision consumes the point; callers may ask about 
availability more than once.
+        return SecurityChecker.getInstance().isEnabled() || 
DebugPointUtil.isEnableWithoutCounting(REJECT_HOST_POINT);
+    }
+
+    public static void validate(String catalogName, ConnectorSecuritySurface 
surface, Map<String, String> properties)
+            throws DdlException {
+        validateAndRemember(catalogName, surface, properties, null);
+    }
+
+    /** A receipt is valid only within one CREATE statement and for the same 
checker instance. */
+    static final class Admission {
+        private final SecurityChecker checker;
+        private final boolean enabled;
+        private final Set<HostAndPort> destinations;
+
+        private Admission(SecurityChecker checker, Set<HostAndPort> 
destinations) {
+            this.checker = checker;
+            this.enabled = checker.isEnabled();
+            this.destinations = Set.copyOf(destinations);
+        }
+    }
+
+    static Admission validateAndRemember(String catalogName, 
ConnectorSecuritySurface surface,
+            Map<String, String> properties, Admission previous) throws 
DdlException {
+        SecurityChecker checker = SecurityChecker.getInstance();
+        DebugPoint rejection = DebugPointUtil.getDebugPoint(REJECT_HOST_POINT);
+        if (!checker.isEnabled() && rejection == null) {
+            return null;
+        }
+        Map<String, Integer> storageEndpoints;
+        Map<String, List<String>> derivedStorageEndpoints;
+        try {
+            storageEndpoints = StorageEndpointProperties.endpoints(properties, 
DatasourcePrintableMap::isSensitiveKey);
+            derivedStorageEndpoints = 
StorageEndpointProperties.derivedEndpointValues(properties);
+        } catch (IllegalArgumentException e) {
+            // Storage routing can fail before URI parsing; never expose 
credential-bearing option values.
+            throw new DdlException("Cannot validate shared storage routing 
against the SSRF policy");
+        }
+        Map<String, List<HostAndPort>> parsedEndpoints = new LinkedHashMap<>();
+        Map<String, Integer> storageKeys = new 
LinkedHashMap<>(storageEndpoints);
+        derivedStorageEndpoints.keySet().forEach(key -> 
storageKeys.putIfAbsent(key, -1));
+        for (Map.Entry<String, Integer> entry : storageKeys.entrySet()) {
+            String key = entry.getKey();
+            int port = entry.getValue() < 0 ? 
surface.ssrfEndpointDefaultPort(key) : entry.getValue();
+            List<String> values = derivedStorageEndpoints.getOrDefault(key,

Review Comment:
   Fixed in 04aeca14e2ca070bbe9f7ed09a899ea7b67b0419.
   
   Paimon now declares the raw fs.oss.endpoint separately from its normalized 
typed storage destination. The recording test calls the actual factory final 
setter into a map and compares that final Hadoop value with the admitted peer, 
without constructing a Hadoop Configuration or SDK client. Explicit HTTP/HTTPS 
targets have unit, CREATE and ALTER controls. An unmodeled bare Hadoop/Jindo 
endpoint fails closed instead of borrowing the native OSS SDK default port; the 
guide documents the required explicit URI/port.
   
   The current head passed 2954 FE tests, strict FE Checkstyle, a fresh FE 
build, and both local SQL suites. Scope and verification limits are recorded in 
the PR description.



##########
fe/fe-connector/fe-connector-fluss/src/main/java/org/apache/doris/connector/fluss/FlussConnectorProvider.java:
##########
@@ -51,16 +57,120 @@ 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")
+                
.withCommaSeparatedSsrfEndpoints(FlussCatalogProperties.BOOTSTRAP_SERVERS)
+                
.withCommaSeparatedSsrfEndpoints(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);
+        // The storage sibling binds canonical names after translating Hadoop 
lake aliases.
+        Map<String, String> storage = 
LakeStorageOptions.toStorageProperties(lake);
+        // Connector storage is published as defaults: even a blank direct key 
remains authoritative.
+        storage.forEach(context::putIfAbsent);
+        // The sibling removes storage options; restoring their aliases could 
bypass a blank direct canonical key.
+        lake.forEach((key, value) -> {
+            if (!LakeStorageOptions.isStorageOption(key)) {
+                context.putIfAbsent(key, value);
+            }
+        });
+        Map<String, String> siblingOptions = new HashMap<>(lake);
+        siblingOptions.keySet().removeIf(LakeStorageOptions::isStorageOption);
+        Map<String, String> storageOrigins = new HashMap<>();
+        for (Map.Entry<String, String> entry : lake.entrySet()) {
+            LakeStorageOptions.toStorageProperties(Map.of(entry.getKey(), 
entry.getValue()))
+                    .forEach((canonical, ignored) -> {
+                        storageOrigins.put(canonical, 
FlussCatalogProperties.LAKE_OPTION_PREFIX + entry.getKey());
+                    });
+        }
+        properties.keySet().forEach(key -> storageOrigins.put(key, key));
+        Map<String, String> inferredProperties = new HashMap<>(properties);
+        try {
+            Predicate<String> opaqueCredential = key ->
+                    base.sensitiveKeyPrefixes().stream().anyMatch(prefix ->
+                            
prefix.covers(FlussCatalogProperties.LAKE_OPTION_PREFIX + key));
+            // Storage clients select ports from the merged canonical map, not 
the original Hadoop alias.
+            Map<String, Integer> endpoints = 
StorageEndpointProperties.endpoints(context, opaqueCredential);
+            surface = withStorageEndpoints(surface, endpoints, context, 
context, storageOrigins);
+            // Warehouses and other sibling options keep their own raw 
interpretation, even beside a direct key.
+            Map<String, Integer> siblingEndpoints =
+                    StorageEndpointProperties.endpoints(siblingOptions, 
opaqueCredential);
+            surface = withStorageEndpoints(surface, siblingEndpoints, 
siblingOptions, context, Map.of());
+            // Derive storage peers from the direct-first context and report 
their actual source property.
+            Map<String, List<String>> derived = 
StorageEndpointProperties.derivedEndpointValues(context);
+            for (Map.Entry<String, List<String>> entry : derived.entrySet()) {
+                String key = entry.getKey();
+                String propertyKey = storageOrigins.getOrDefault(key, 
FlussCatalogProperties.LAKE_OPTION_PREFIX + key);
+                surface = surface.withSsrfEndpointValues(propertyKey, 
entry.getValue().toArray(new String[0]));
+            }
+            lake.keySet().stream().filter(key -> 
LakeStorageOptions.isStorageOption(key)
+                    || siblingEndpoints.containsKey(key) || 
key.endsWith(".proxy.username"))
+                    .forEach(key -> 
inferredProperties.remove(FlussCatalogProperties.LAKE_OPTION_PREFIX + key));
+        } catch (IllegalArgumentException e) {
+            // Surface lookup also runs without a checker; let only enabled 
admission reject unknown routes.
+            return 
surface.withSsrfEndpointValues(FlussCatalogProperties.LAKE_OPTION_PREFIX + 
"warehouse",
+                    "unmodeled-lake-route:0");
+        }
+        Map<String, String> restOrigins = 
PaimonSiblingProperties.catalogRestOptionKeys(properties, lake);

Review Comment:
   Fixed in 04aeca14e2ca070bbe9f7ed09a899ea7b67b0419.
   
   The gateway uses the sibling mapping to retire REST interpretations for an 
explicitly filesystem- or Hive-pinned lake, preserving independent storage 
routes. The shared override extractor removes blank values, so missing/blank 
and unknown cluster-dependent flavors remain conservatively checked. Recording 
cases cover all three direct/nested URI forms, sibling synthesis verifies 
catalog overrides beat cluster REST defaults, and SQL checks 
activation/refusal/retention for both pinned flavors.
   
   The current head passed 2954 FE tests, strict FE Checkstyle, a fresh FE 
build, and both local SQL suites. Scope and verification limits are recorded in 
the PR description.



##########
fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergConnectorProvider.java:
##########
@@ -95,11 +102,226 @@ public ConnectorSecuritySurface securitySurface() {
         // Keep secret masking and JDBC restrictions when REST decryption adds 
a KMS endpoint check.
         return 
ConnectorSecuritySurface.ofJdbcDriverUrls("iceberg.catalog.type", 
"iceberg.jdbc.driver_url")
                 .withSensitiveKeys(MetaStoreProviders.sensitivePropertyKeys())
+                
.withSensitiveKeys(JdbcTlsStoreUrlSecurity.sensitivePropertyKeys("jdbc."))
                 // Protect inline SDK credentials even when the additional 
name-pattern rule is disabled.
                 .withSensitiveKeys(List.of("gcp.auth.credentials-json", 
"gcs.oauth2.token",
                         "gcs.encryption-key", "gcs.decryption-key"))
-                // Standalone DLF proxies open HMS clients too; Hive's surface 
only covers HMS catalogs.
-                .withSsrfEndpoints("kms.endpoint", "hive.metastore.uris", 
"uri", "metastore.thrift.uris")
+                .withSensitiveKeyPrefix("client.credentials-provider.",
+                        "credential", "password", "secret", "token", "key", 
"authorization", "header")
+                .withSsrfEndpoints("kms.endpoint", "iceberg.rest.uri", "uri",
+                        "hive.metastore.uris", "metastore.thrift.uris", 
"s3tables.endpoint", "iceberg.jdbc.uri",
+                        "dynamodb.endpoint",
+                        "http-client.proxy-endpoint", "signer.uri")
+                // Native GCS overrides its storage service host independently 
of the catalog's REST URI.
+                .withSsrfEndpoints("gcs.service.host")
+                .withCommaSeparatedSsrfEndpoints("hive.metastore.uris", 
"metastore.thrift.uris")
+                .withSsrfEndpoints("glue.endpoint", "aws.endpoint", 
"aws.glue.endpoint")
+                // DLF accepts bare hosts and uses HTTPS, including on its 
standalone HMS proxy path.
                 .withSsrfEndpoints(443, "dlf.endpoint", 
"dlf.catalog.endpoint");
     }
+
+    @Override
+    public ConnectorSecuritySurface securitySurface(Map<String, String> 
properties) {
+        // Retired aliases and inactive proxy clients must not contribute 
unused metadata destinations.
+        ConnectorSecuritySurface surface = securitySurface()
+                
.withSsrfEndpointValues("dlf.endpoint").withSsrfEndpointValues("dlf.catalog.endpoint");
+        String flavor = 
properties.getOrDefault(IcebergCatalogProperties.ICEBERG_CATALOG_TYPE,
+                IcebergCatalogProperties.TYPE_HMS).trim();
+        if (!IcebergCatalogProperties.TYPE_REST.equalsIgnoreCase(flavor)) {
+            // HMS siblings inherit raw options; a saved REST URI becomes a 
route only after selecting REST.
+            surface = surface.withSsrfEndpointValues("iceberg.rest.uri");
+        }
+        if (!IcebergCatalogProperties.TYPE_GLUE.equalsIgnoreCase(flavor)) {
+            // These aliases can independently bind storage; Hadoop/HMS do not 
also construct a Glue client.
+            surface = 
surface.withSsrfEndpointValues("glue.endpoint").withSsrfEndpointValues("aws.endpoint")
+                    .withSsrfEndpointValues("aws.glue.endpoint");
+        }
+        boolean typedOauthEndpoint = 
IcebergCatalogProperties.TYPE_REST.equalsIgnoreCase(flavor)
+                && IcebergCatalogFactory.usesTypedRestOauthEndpoint(
+                        boundString(properties, "iceberg.rest.security.type"),
+                        boundString(properties, 
"iceberg.rest.oauth2.credential"),
+                        boundString(properties, 
"iceberg.rest.oauth2.server-uri"));
+        Map<String, String> endpointProperties = new HashMap<>(properties);
+        for (String key : new String[] {"signer.endpoint", 
"rest.remote-signing.endpoint",
+                "client.refresh-credentials-endpoint", 
"iceberg.rest.oauth2.server-uri", "oauth2-server-uri",
+                "client.credentials-provider.oauth2-server-uri", 
"gcs.oauth2.refresh-credentials-endpoint"}) {
+            String value = properties.get(key);
+            if (value != null && key.equals("iceberg.rest.oauth2.server-uri")) 
{
+                if (!typedOauthEndpoint) {
+                    // Token-only and non-REST clients never receive this 
typed option from the factory.
+                    endpointProperties.remove(key);
+                    continue;
+                }
+                // The canonical holder trims Strings before emitting the SDK 
OAuth option; raw aliases do not.
+                value = value.trim();
+            }
+            // Iceberg appends signer, credential-refresh and OAuth paths 
(including GCS refresh) to a checked base.
+            // Only these lowercase absolute forms replace that base with an 
independent destination.
+            if (value != null && (value.startsWith("http://";) || 
value.startsWith("https://";))) {
+                surface = surface.withSsrfEndpoints(key);
+            } else {
+                endpointProperties.remove(key);
+            }
+        }
+        if (typedOauthEndpoint) {
+            // The typed OAuth option replaces the raw SDK route even when it 
is a relative path.
+            surface = surface.withSsrfEndpointValues("oauth2-server-uri");
+            endpointProperties.remove("oauth2-server-uri");
+        }
+        if (properties.containsKey("rest.client.proxy.port")) {
+            // The REST client activates this separate host only when a port 
is supplied, including on ALTER.
+            surface = surface.withSsrfEndpoints("rest.client.proxy.hostname");
+            int port = 
explicitProxyPort(properties.get("rest.client.proxy.port"));
+            if (port > 0) {
+                surface = surface.withSsrfEndpoints(port, 
"rest.client.proxy.hostname");
+            }
+        }
+        surface = withProviderProxyEndpoints(surface, properties);
+        // Google credentials are opaque secrets, but their structured token 
endpoints select independent peers.
+        for (String key : new String[] {"gcp.auth.credentials-json",

Review Comment:
   Fixed in 04aeca14e2ca070bbe9f7ed09a899ea7b67b0419.
   
   Google JSON token routes stay dormant with stock HadoopCatalog/HadoopFileIO. 
Google storage signals and explicit FileIO/client, implementation or resource 
overrides retain conservative checking; REST and other metastore flavors are 
unchanged. Schema validation is retained. Tests cover both JSON keys, 
HDFS/local/S3 warehouses, ten consumer/implementation overrides, actual pure 
factory option selection, and SQL FileIO activation with immediate retention 
checks after refusal.
   
   The current head passed 2954 FE tests, strict FE Checkstyle, a fresh FE 
build, and both local SQL suites. Scope and verification limits are recorded in 
the PR description.



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