hello-stephen commented on code in PR #71205: URL: https://github.com/apache/doris/pull/71205#discussion_r4755800295
########## fe/fe-core/src/main/java/org/apache/doris/connector/CatalogEndpointSecurity.java: ########## @@ -0,0 +1,251 @@ +// 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 java.net.IDN; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +/** 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); + } + + public static void validate(String catalogName, ConnectorSecuritySurface surface, Map<String, String> properties) + throws DdlException { + SecurityChecker checker = SecurityChecker.getInstance(); + DebugPoint rejection = DebugPointUtil.getDebugPoint(REJECT_HOST_POINT); + if (!checker.isEnabled() && rejection == null) { + return; + } + Map<String, Integer> storageEndpoints = + StorageEndpointProperties.endpoints(properties, DatasourcePrintableMap::isSensitiveKey); + Map<String, Integer> endpoints = new LinkedHashMap<>(storageEndpoints); + for (String key : surface.ssrfEndpointKeys(properties)) { + int defaultPort = surface.ssrfEndpointDefaultPort(key); + endpoints.put(key, defaultPort < 0 ? endpoints.getOrDefault(key, -1) : defaultPort); + } + // Driver downloads can connect during pre-validation, before a connector's connectivity test. + String flavor = surface.jdbcDriverUrlFlavorKey(); + String flavorValue = flavor == null ? "jdbc" : properties.getOrDefault(flavor, "").trim(); + if ("jdbc".equalsIgnoreCase(flavorValue)) { + for (String key : surface.jdbcDriverUrlKeys()) { + String value = properties.getOrDefault(key, "").trim().toLowerCase(Locale.ROOT); + if (value.startsWith("http://") || value.startsWith("https://")) { + endpoints.put(key, -1); + } + } + } + // Validate every candidate on ALTER: a flavor/authentication change can activate a stored address + // without modifying its key. Replays never enter this statement-time path. + Map<String, List<HostAndPort>> parsedEndpoints = new LinkedHashMap<>(); + for (Map.Entry<String, Integer> entry : endpoints.entrySet()) { + String key = entry.getKey(); + String value = properties.get(key); + if (value == null || value.trim().isEmpty()) { + continue; + } + if (value.contains("${")) { + throw new DdlException("Endpoint property '" + key + "' must be literal under the SSRF policy; " + + "a placeholder can change its destination after validation"); + } + List<HostAndPort> destinations; + try { + destinations = new ArrayList<>(); + for (String endpoint : surface.ssrfEndpointValues(key, value)) { + if (storageEndpoints.getOrDefault(key, -1) == 8020) { + for (String authority : HdfsEndpointProperties.authorities(endpoint.trim(), properties)) { + destinations.add(parseAuthority(authority, 8020)); + } + } else { + destinations.addAll(parseEndpoints(endpoint.trim(), entry.getValue())); + } + } + } catch (IllegalArgumentException e) { + // Do not echo URLs: their authority or query can carry credentials. + throw new DdlException("Cannot validate endpoint property '" + key + "' of catalog '" + + catalogName + "' against the SSRF policy: use an explicit network URI or host:port"); + } + parsedEndpoints.put(key, destinations); + } + for (Map.Entry<String, List<HostAndPort>> entry : parsedEndpoints.entrySet()) { + String key = entry.getKey(); + for (HostAndPort destination : entry.getValue()) { + // A fail-only seam lets SQL regression tests exercise routing without the optional SDK. + // It cannot bypass a real policy rejection or allow a connection. + if (rejection != null && destination.getHost().equals(rejection.param("host", "127.0.0.1"))) { + throw new DdlException("Endpoint property '" + key + "' is rejected by the SSRF policy"); + } + checker.checkEndpointForSsrf(destination.getHost(), destination.getPort()); + } + } + } + + /** Parses URI lists, multi-host authorities and scheme-less endpoints without splitting URL path commas. */ + public static List<HostAndPort> parseEndpoints(String value, int defaultPort) { + String normalized = value.trim(); + List<HostAndPort> result = parseUnnormalizedEndpoints(normalized, defaultPort); + if (normalized.regionMatches(true, 0, "jdbc:", 0, 5) && normalized.contains(" ")) { + // Standalone JDBC strips spaces; Paimon and Iceberg pass the raw URL to their drivers. + // Checking both interpretations prevents normalization from hiding an active host override. + LinkedHashSet<HostAndPort> destinations = new LinkedHashSet<>(result); + destinations.addAll(parseUnnormalizedEndpoints(normalized.replace(" ", ""), defaultPort)); + return new ArrayList<>(destinations); + } + return result; + } + + private static List<HostAndPort> parseUnnormalizedEndpoints(String normalized, int defaultPort) { + List<HostAndPort> result = new ArrayList<>(); + // JDBC-specific parameters and Oracle descriptors are not ordinary URI authorities. + if (normalized.regionMatches(true, 0, "jdbc:mysql:", 0, 11) + || normalized.regionMatches(true, 0, "jdbc:mysql+srv:", 0, 15)) { + return JdbcEndpointParser.mysql(normalized); + } + if (normalized.startsWith("jdbc:postgresql:")) { + return JdbcEndpointParser.postgresql(normalized); + } + if (normalized.startsWith("jdbc:sqlserver://")) { + return JdbcEndpointParser.sqlServer(normalized); + } + if (normalized.startsWith("jdbc:oracle:thin:")) { + return JdbcEndpointParser.oracle(normalized); + } + if (normalized.startsWith("jdbc:")) { + normalized = normalized.substring(5); + } + for (String endpoint : normalized.split(",(?=\\s*[A-Za-z][A-Za-z0-9+.-]*://)", -1)) { Review Comment: [P2] Validate DB2's configured client-reroute destinations `jdbc:db2://allowed.example.com:50000/db:enableClientAffinitiesList=1;clientRerouteAlternateServerName=allowed.example.com,127.0.0.1;clientRerouteAlternatePortNumber=50000,1544;` reaches this generic fallback and probes only the primary authority. [IBM documents these URL properties](https://cloud.ibm.com/docs/db2-saas?topic=db2-saas-automatic-client-reroute-setup-acr) and confirms that [the client-side affinity list needs no server discovery](https://www.ibm.com/support/pages/faq-how-configure-jdbc-driver-automatic-client-re-route). JCC can therefore try `127.0.0.1:1544` when the primary is unavailable, but all those path properties are ignored here. Doris preserves the DB2 URL, so CREATE with `test_connection=false` and ALTER can accept a literal destination the configured admission policy would reject. The later JDBC sanitizer is independent. Parse the alternate host/port pairs or reject unsupported reroute options, with enabled-policy coverage. ########## fe/fe-core/src/main/java/org/apache/doris/connector/CatalogEndpointSecurity.java: ########## @@ -0,0 +1,251 @@ +// 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 java.net.IDN; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +/** 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); + } + + public static void validate(String catalogName, ConnectorSecuritySurface surface, Map<String, String> properties) + throws DdlException { + SecurityChecker checker = SecurityChecker.getInstance(); + DebugPoint rejection = DebugPointUtil.getDebugPoint(REJECT_HOST_POINT); + if (!checker.isEnabled() && rejection == null) { + return; + } + Map<String, Integer> storageEndpoints = + StorageEndpointProperties.endpoints(properties, DatasourcePrintableMap::isSensitiveKey); + Map<String, Integer> endpoints = new LinkedHashMap<>(storageEndpoints); + for (String key : surface.ssrfEndpointKeys(properties)) { + int defaultPort = surface.ssrfEndpointDefaultPort(key); + endpoints.put(key, defaultPort < 0 ? endpoints.getOrDefault(key, -1) : defaultPort); + } + // Driver downloads can connect during pre-validation, before a connector's connectivity test. + String flavor = surface.jdbcDriverUrlFlavorKey(); + String flavorValue = flavor == null ? "jdbc" : properties.getOrDefault(flavor, "").trim(); + if ("jdbc".equalsIgnoreCase(flavorValue)) { + for (String key : surface.jdbcDriverUrlKeys()) { + String value = properties.getOrDefault(key, "").trim().toLowerCase(Locale.ROOT); + if (value.startsWith("http://") || value.startsWith("https://")) { + endpoints.put(key, -1); + } + } + } + // Validate every candidate on ALTER: a flavor/authentication change can activate a stored address + // without modifying its key. Replays never enter this statement-time path. + Map<String, List<HostAndPort>> parsedEndpoints = new LinkedHashMap<>(); + for (Map.Entry<String, Integer> entry : endpoints.entrySet()) { + String key = entry.getKey(); + String value = properties.get(key); + if (value == null || value.trim().isEmpty()) { + continue; + } + if (value.contains("${")) { + throw new DdlException("Endpoint property '" + key + "' must be literal under the SSRF policy; " + + "a placeholder can change its destination after validation"); + } + List<HostAndPort> destinations; + try { + destinations = new ArrayList<>(); + for (String endpoint : surface.ssrfEndpointValues(key, value)) { + if (storageEndpoints.getOrDefault(key, -1) == 8020) { + for (String authority : HdfsEndpointProperties.authorities(endpoint.trim(), properties)) { + destinations.add(parseAuthority(authority, 8020)); + } + } else { + destinations.addAll(parseEndpoints(endpoint.trim(), entry.getValue())); + } + } + } catch (IllegalArgumentException e) { + // Do not echo URLs: their authority or query can carry credentials. + throw new DdlException("Cannot validate endpoint property '" + key + "' of catalog '" + + catalogName + "' against the SSRF policy: use an explicit network URI or host:port"); + } + parsedEndpoints.put(key, destinations); + } + for (Map.Entry<String, List<HostAndPort>> entry : parsedEndpoints.entrySet()) { + String key = entry.getKey(); + for (HostAndPort destination : entry.getValue()) { + // A fail-only seam lets SQL regression tests exercise routing without the optional SDK. + // It cannot bypass a real policy rejection or allow a connection. + if (rejection != null && destination.getHost().equals(rejection.param("host", "127.0.0.1"))) { + throw new DdlException("Endpoint property '" + key + "' is rejected by the SSRF policy"); + } + checker.checkEndpointForSsrf(destination.getHost(), destination.getPort()); + } + } + } + + /** Parses URI lists, multi-host authorities and scheme-less endpoints without splitting URL path commas. */ + public static List<HostAndPort> parseEndpoints(String value, int defaultPort) { + String normalized = value.trim(); + List<HostAndPort> result = parseUnnormalizedEndpoints(normalized, defaultPort); + if (normalized.regionMatches(true, 0, "jdbc:", 0, 5) && normalized.contains(" ")) { + // Standalone JDBC strips spaces; Paimon and Iceberg pass the raw URL to their drivers. + // Checking both interpretations prevents normalization from hiding an active host override. + LinkedHashSet<HostAndPort> destinations = new LinkedHashSet<>(result); + destinations.addAll(parseUnnormalizedEndpoints(normalized.replace(" ", ""), defaultPort)); + return new ArrayList<>(destinations); + } + return result; + } + + private static List<HostAndPort> parseUnnormalizedEndpoints(String normalized, int defaultPort) { + List<HostAndPort> result = new ArrayList<>(); + // JDBC-specific parameters and Oracle descriptors are not ordinary URI authorities. + if (normalized.regionMatches(true, 0, "jdbc:mysql:", 0, 11) + || normalized.regionMatches(true, 0, "jdbc:mysql+srv:", 0, 15)) { + return JdbcEndpointParser.mysql(normalized); + } + if (normalized.startsWith("jdbc:postgresql:")) { + return JdbcEndpointParser.postgresql(normalized); + } + if (normalized.startsWith("jdbc:sqlserver://")) { + return JdbcEndpointParser.sqlServer(normalized); + } + if (normalized.startsWith("jdbc:oracle:thin:")) { + return JdbcEndpointParser.oracle(normalized); + } + if (normalized.startsWith("jdbc:")) { + normalized = normalized.substring(5); Review Comment: [P2] Preserve ClickHouse's explicit transport URL form With the checker enabled, `jdbc:clickhouse:https://allowed.example.com:8443/db` is rejected even when its destination is allowed. Removing only `jdbc:` leaves an opaque `clickhouse:https://...` URI, so `parseSingle` finds no authority and throws. Doris accepts the ClickHouse prefix and preserves this URL; the [ClickHouse 0.9.8 driver used by the regression suite](https://github.com/ClickHouse/clickhouse-java/blob/v0.9.8/jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/JdbcConfiguration.java#L156-L190) removes the full `jdbc:clickhouse:` prefix before parsing HTTP(S). This blocks CREATE, lazy reconstruction and ALTER revalidation of otherwise valid catalogs. Handle ClickHouse's optional transport prefix and add enabled-policy acceptance/rejection cases. ########## fe/fe-core/src/main/java/org/apache/doris/connector/CatalogEndpointSecurity.java: ########## @@ -0,0 +1,251 @@ +// 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 java.net.IDN; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +/** 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); + } + + public static void validate(String catalogName, ConnectorSecuritySurface surface, Map<String, String> properties) + throws DdlException { + SecurityChecker checker = SecurityChecker.getInstance(); + DebugPoint rejection = DebugPointUtil.getDebugPoint(REJECT_HOST_POINT); + if (!checker.isEnabled() && rejection == null) { + return; + } + Map<String, Integer> storageEndpoints = + StorageEndpointProperties.endpoints(properties, DatasourcePrintableMap::isSensitiveKey); + Map<String, Integer> endpoints = new LinkedHashMap<>(storageEndpoints); + for (String key : surface.ssrfEndpointKeys(properties)) { + int defaultPort = surface.ssrfEndpointDefaultPort(key); + endpoints.put(key, defaultPort < 0 ? endpoints.getOrDefault(key, -1) : defaultPort); + } + // Driver downloads can connect during pre-validation, before a connector's connectivity test. + String flavor = surface.jdbcDriverUrlFlavorKey(); + String flavorValue = flavor == null ? "jdbc" : properties.getOrDefault(flavor, "").trim(); + if ("jdbc".equalsIgnoreCase(flavorValue)) { + for (String key : surface.jdbcDriverUrlKeys()) { + String value = properties.getOrDefault(key, "").trim().toLowerCase(Locale.ROOT); + if (value.startsWith("http://") || value.startsWith("https://")) { + endpoints.put(key, -1); + } + } + } + // Validate every candidate on ALTER: a flavor/authentication change can activate a stored address + // without modifying its key. Replays never enter this statement-time path. + Map<String, List<HostAndPort>> parsedEndpoints = new LinkedHashMap<>(); + for (Map.Entry<String, Integer> entry : endpoints.entrySet()) { + String key = entry.getKey(); + String value = properties.get(key); + if (value == null || value.trim().isEmpty()) { + continue; + } + if (value.contains("${")) { + throw new DdlException("Endpoint property '" + key + "' must be literal under the SSRF policy; " + + "a placeholder can change its destination after validation"); + } + List<HostAndPort> destinations; + try { + destinations = new ArrayList<>(); + for (String endpoint : surface.ssrfEndpointValues(key, value)) { + if (storageEndpoints.getOrDefault(key, -1) == 8020) { + for (String authority : HdfsEndpointProperties.authorities(endpoint.trim(), properties)) { + destinations.add(parseAuthority(authority, 8020)); + } + } else { + destinations.addAll(parseEndpoints(endpoint.trim(), entry.getValue())); + } + } + } catch (IllegalArgumentException e) { + // Do not echo URLs: their authority or query can carry credentials. + throw new DdlException("Cannot validate endpoint property '" + key + "' of catalog '" + + catalogName + "' against the SSRF policy: use an explicit network URI or host:port"); + } + parsedEndpoints.put(key, destinations); + } + for (Map.Entry<String, List<HostAndPort>> entry : parsedEndpoints.entrySet()) { + String key = entry.getKey(); + for (HostAndPort destination : entry.getValue()) { + // A fail-only seam lets SQL regression tests exercise routing without the optional SDK. + // It cannot bypass a real policy rejection or allow a connection. + if (rejection != null && destination.getHost().equals(rejection.param("host", "127.0.0.1"))) { + throw new DdlException("Endpoint property '" + key + "' is rejected by the SSRF policy"); + } + checker.checkEndpointForSsrf(destination.getHost(), destination.getPort()); + } + } + } + + /** Parses URI lists, multi-host authorities and scheme-less endpoints without splitting URL path commas. */ + public static List<HostAndPort> parseEndpoints(String value, int defaultPort) { + String normalized = value.trim(); + List<HostAndPort> result = parseUnnormalizedEndpoints(normalized, defaultPort); + if (normalized.regionMatches(true, 0, "jdbc:", 0, 5) && normalized.contains(" ")) { + // Standalone JDBC strips spaces; Paimon and Iceberg pass the raw URL to their drivers. + // Checking both interpretations prevents normalization from hiding an active host override. + LinkedHashSet<HostAndPort> destinations = new LinkedHashSet<>(result); + destinations.addAll(parseUnnormalizedEndpoints(normalized.replace(" ", ""), defaultPort)); + return new ArrayList<>(destinations); + } + return result; + } + + private static List<HostAndPort> parseUnnormalizedEndpoints(String normalized, int defaultPort) { + List<HostAndPort> result = new ArrayList<>(); + // JDBC-specific parameters and Oracle descriptors are not ordinary URI authorities. + if (normalized.regionMatches(true, 0, "jdbc:mysql:", 0, 11) + || normalized.regionMatches(true, 0, "jdbc:mysql+srv:", 0, 15)) { + return JdbcEndpointParser.mysql(normalized); + } + if (normalized.startsWith("jdbc:postgresql:")) { + return JdbcEndpointParser.postgresql(normalized); + } + if (normalized.startsWith("jdbc:sqlserver://")) { + return JdbcEndpointParser.sqlServer(normalized); + } + if (normalized.startsWith("jdbc:oracle:thin:")) { + return JdbcEndpointParser.oracle(normalized); + } + if (normalized.startsWith("jdbc:")) { + normalized = normalized.substring(5); + } + for (String endpoint : normalized.split(",(?=\\s*[A-Za-z][A-Za-z0-9+.-]*://)", -1)) { + parseSingle(endpoint.trim(), defaultPort, result); + } + return result; + } + + private static void parseSingle(String endpoint, int defaultPort, List<HostAndPort> result) { + if (endpoint.isEmpty()) { + throw new IllegalArgumentException("Empty endpoint"); + } + if (endpoint.regionMatches(true, 0, "file:", 0, 5)) { + try { + URI local = new URI(endpoint); + String authority = local.getRawAuthority(); + if (local.isOpaque() || (authority != null && !authority.isEmpty() + && !"localhost".equalsIgnoreCase(authority))) { + throw new IllegalArgumentException("Remote or opaque file URI"); + } + return; + } catch (URISyntaxException e) { + throw new IllegalArgumentException("Invalid local file URI"); + } + } + if (!endpoint.contains("://")) { + String authority = endpoint.split("/", 2)[0]; + for (String host : authority.split(",", -1)) { + result.add(parseAuthority(host.trim(), defaultPort)); + } + return; + } + URI uri; + try { + uri = new URI(endpoint); + } catch (URISyntaxException e) { + throw new IllegalArgumentException("Invalid endpoint URI"); + } + String scheme = uri.getScheme().toLowerCase(Locale.ROOT); + String authority = uri.getRawAuthority(); + if (authority == null || authority.isEmpty()) { + throw new IllegalArgumentException("Missing endpoint authority"); + } + authority = authority.substring(authority.lastIndexOf('@') + 1); + int port = defaultPortForScheme(scheme, defaultPort); Review Comment: [P2] Resolve native PostgreSQL URI routing before ADBC admission An ADBC catalog with `uri=postgresql://allowed.example.com/db?hostaddr=127.0.0.1&port=1544` passes enabled-policy admission after probing only `allowed.example.com:5432`. `AdbcClient.buildParameters()` forwards this URI unchanged to JNI. The [ADBC PostgreSQL driver wraps libpq](https://arrow.apache.org/adbc/current/driver/postgresql.html), where [a supplied hostaddr determines the actual address even when host is present](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS); the configured destination is therefore `127.0.0.1:1544`. Only `jdbc:postgresql:` enters the specialized parser, leaving this native URI's routing parameters unchecked. Parse libpq destinations or reject unsupported routing parameters, and cover rejecting-policy CREATE/ALTER. This is a literal admission omission, separate from the documented native runtime-interception limits. -- 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]
