This is an automated email from the ASF dual-hosted git repository.
Gabriel39 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new e55e69da02f [fix](catalog) Validate JDBC drivers before creating
sibling connectors (#71191)
e55e69da02f is described below
commit e55e69da02f5a48e43cd6605e6a89d0c5199a50e
Author: Gabriel <[email protected]>
AuthorDate: Tue Dec 1 15:29:38 2026 +0800
[fix](catalog) Validate JDBC drivers before creating sibling connectors
(#71191)
### Background
Fluss lake reads build an embedded Paimon connector from table metadata
and catalog lake options. Sibling connectors share the gateway catalog
context and are constructed outside standalone catalog CREATE/ALTER
validation.
### What problem does this PR solve?
Issue Number: None
Related PR: #66399 (introduced the Fluss lake synthesis)
PR Type: Bugfix
Problem Summary:
Lake options could overwrite the gateway-selected Paimon catalog type
and reach JDBC driver loading without the usual driver policy checks.
Reject the reserved type option and check a sibling's declared JDBC
driver properties before constructing it. The same driver validator
serves ALTER CATALOG and normalizes values the same way as the property
binder.
For example, a nested lake option setting paimon.catalog.type previously
replaced the validated metastore choice; lake resolution now reports
that the option is reserved.
### Details
- **Frequency:** Always for the conflicting lake option in the local
baseline unit tests; no live malicious-driver execution was attempted.
- **Root cause:** PaimonSiblingProperties applied an unrestricted
overlay after setting the selected type. DefaultConnectorContext then
called the sibling factory without the driver validation that standalone
catalog statements apply.
- **Why existing tests missed it:** PaimonSiblingPropertiesTest covered
normal options and unsupported metastore names, but not the alternate
type spelling. DefaultConnectorContextSiblingTest checked factory wiring
without a JDBC security surface. The Fluss lake override integration
suite covered warehouse and metastore changes, but not a reserved type
override. The ALTER driver gate tests omitted padded JDBC flavors.
- **Fix:** Reject the reserved key at lake property synthesis. Apply the
mandatory driver URL rule and the operator secure-path/URL allow-list
policy before sibling creation, using the target provider's security
surface. Share this validation with ALTER while preserving its
touched-property guard.
- **Other paths and branches:** The common context also protects other
JDBC-bearing siblings. Standalone catalog replay retains its existing
validation timing. The introducing Fluss code is absent from the freshly
checked branch-3.1, branch-4.0, branch-4.1 and branch-4.2 trees.
- **Behavior change:** Conflicting lake type options and sibling drivers
rejected by the configured policies now fail before a connector can load
the driver. Inactive driver properties remain inert. No configuration or
privilege changes.
### Testing
Local FE unit runner passed 109 tests in seven classes, with zero
failures, errors or skips: lake synthesis and catalog properties,
sibling creation and cache ownership, plugin configuration, ALTER driver
policies, and JDBC resources. The two lake-option tests and 12 engine
policy cases failed on the corresponding unfixed baseline because
invalid inputs were accepted.
The Fluss lake override integration suite now checks the reserved type
through ALTER and a lake query. It was not run locally because the
Fluss/MinIO fixture is unavailable.
### Notes for Reviewers
Driver policies are checked before the sibling provider can allocate a
connector or load a driver. The shared helper keeps ALTER's existing
touched-key guard and matches the property binder's whitespace
normalization.
### Release note
None
### Check List (For Author)
- Behavior changed: Yes (see Details).
- Does this need documentation: No; this restores the supported
metastore and existing driver-policy contracts.
- Pre-submission status: Partially verified: local unit tests passed;
the Fluss/MinIO integration case was not run.
### AI Disclosure
- Tool: Codex (GPT-6).
- Generated: implementation, tests and this description.
- Human review: Not stated.
- Prompts: Analyze the lake sibling issue, fix it on master with driver
validation, and submit a pull request.
---
.../connector/fluss/PaimonSiblingProperties.java | 5 +
.../fluss/PaimonSiblingPropertiesTest.java | 30 +++++
.../doris/connector/DefaultConnectorContext.java | 17 ++-
.../DefaultConnectorValidationContext.java | 30 +++++
.../plugin/PluginDrivenExternalCatalog.java | 26 +---
.../DefaultConnectorContextSiblingTest.java | 140 ++++++++++++++++++++-
...uginDrivenExternalCatalogDriverUrlGateTest.java | 12 ++
.../fluss/test_fluss_lake_override.groovy | 10 ++
8 files changed, 242 insertions(+), 28 deletions(-)
diff --git
a/fe/fe-connector/fe-connector-fluss/src/main/java/org/apache/doris/connector/fluss/PaimonSiblingProperties.java
b/fe/fe-connector/fe-connector-fluss/src/main/java/org/apache/doris/connector/fluss/PaimonSiblingProperties.java
index 5a1c439edfa..9dbaef4aadc 100644
---
a/fe/fe-connector/fe-connector-fluss/src/main/java/org/apache/doris/connector/fluss/PaimonSiblingProperties.java
+++
b/fe/fe-connector/fe-connector-fluss/src/main/java/org/apache/doris/connector/fluss/PaimonSiblingProperties.java
@@ -119,6 +119,11 @@ final class PaimonSiblingProperties {
}
Map<String, String> lakeOptions = new
LinkedHashMap<>(clusterLakeOptions);
lakeOptions.putAll(catalogLakeOverrides);
+ // The gateway owns the sibling flavor; an overlay must not enable an
unsupported JDBC loader.
+ if (lakeOptions.containsKey(PAIMON_CATALOG_TYPE)) {
+ throw new DorisConnectorException("Lake option '" +
PAIMON_CATALOG_TYPE
+ + "' is reserved; configure the lake metastore through '"
+ FLUSS_METASTORE + "'");
+ }
String catalogType =
dorisCatalogType(lakeOptions.remove(FLUSS_METASTORE));
String warehouse = lakeOptions.remove(WAREHOUSE);
diff --git
a/fe/fe-connector/fe-connector-fluss/src/test/java/org/apache/doris/connector/fluss/PaimonSiblingPropertiesTest.java
b/fe/fe-connector/fe-connector-fluss/src/test/java/org/apache/doris/connector/fluss/PaimonSiblingPropertiesTest.java
index aef46263af9..805fe4a9b96 100644
---
a/fe/fe-connector/fe-connector-fluss/src/test/java/org/apache/doris/connector/fluss/PaimonSiblingPropertiesTest.java
+++
b/fe/fe-connector/fe-connector-fluss/src/test/java/org/apache/doris/connector/fluss/PaimonSiblingPropertiesTest.java
@@ -71,6 +71,36 @@ public class PaimonSiblingPropertiesTest {
PaimonSiblingProperties.synthesize(flussTableProperties(),
noOverrides()));
}
+ @Test
+ public void tableLakeOptionsCannotOverrideTheSiblingFlavor() {
+ Map<String, String> properties = flussTableProperties();
+ properties.put("table.datalake.paimon.paimon.catalog.type", "jdbc");
+
+ DorisConnectorException failure =
Assertions.assertThrows(DorisConnectorException.class,
+ () -> PaimonSiblingProperties.synthesize(properties,
noOverrides()));
+
Assertions.assertTrue(failure.getMessage().contains("paimon.catalog.type"),
failure.getMessage());
+ }
+
+ @Test
+ public void catalogLakeOverridesCannotOverrideTheSiblingFlavor() {
+ Map<String, String> catalog = new HashMap<>();
+ catalog.put("fluss.bootstrap.servers", "fluss.example:9123");
+ catalog.put("fluss.lake.paimon.paimon.catalog.type", "jdbc");
+ FlussCatalogProperties bound = FlussCatalogProperties.of(catalog);
+
+ DorisConnectorException failure =
Assertions.assertThrows(DorisConnectorException.class,
+ () -> PaimonSiblingProperties.synthesize(catalog,
flussTableProperties(), bound.getLakeOverrides()));
+
Assertions.assertTrue(failure.getMessage().contains("paimon.catalog.type"),
failure.getMessage());
+ }
+
+ @Test
+ public void directGatewayFlavorCannotOverrideTheValidatedMetastore() {
+ Map<String, String> catalog =
Collections.singletonMap("paimon.catalog.type", "jdbc");
+
+ Assertions.assertEquals("filesystem",
PaimonSiblingProperties.synthesize(
+ catalog, flussTableProperties(),
noOverrides()).get("paimon.catalog.type"));
+ }
+
@Test
public void nonLakePropertiesAreNotForwarded() {
Map<String, String> properties = flussTableProperties();
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/connector/DefaultConnectorContext.java
b/fe/fe-core/src/main/java/org/apache/doris/connector/DefaultConnectorContext.java
index c08b4a43066..2a3f2249b52 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/connector/DefaultConnectorContext.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/connector/DefaultConnectorContext.java
@@ -22,6 +22,7 @@ import org.apache.doris.catalog.FsBroker;
import org.apache.doris.cloud.security.SecurityChecker;
import org.apache.doris.common.ClientPool;
import org.apache.doris.common.Config;
+import org.apache.doris.common.DdlException;
import org.apache.doris.common.EnvUtils;
import org.apache.doris.common.ThreadPoolManager;
import org.apache.doris.common.Version;
@@ -32,8 +33,11 @@ import org.apache.doris.connector.spi.Connector;
import org.apache.doris.connector.spi.ConnectorBrokerAddress;
import org.apache.doris.connector.spi.ConnectorContext;
import org.apache.doris.connector.spi.ConnectorHttpSecurityHook;
+import org.apache.doris.connector.spi.ConnectorProvider;
+import org.apache.doris.connector.spi.ConnectorSecuritySurface;
import org.apache.doris.connector.spi.ConnectorSession;
import org.apache.doris.connector.spi.ConnectorStorageContext;
+import org.apache.doris.connector.spi.DorisConnectorException;
import org.apache.doris.datasource.CatalogIf;
import org.apache.doris.datasource.ExternalCatalog;
import org.apache.doris.datasource.credentials.CredentialUtils;
@@ -244,7 +248,18 @@ public class DefaultConnectorContext implements
ConnectorContext, ConnectorStora
// Returns null when no provider matches the type (or the plugin
manager is not initialized); the
// gateway caller null-checks and fails loud with its own
(connector-specific) message — fe-core stays
// connector-agnostic and does no property parsing here.
- return cacheOwner.create(() ->
ConnectorFactory.createConnector(catalogType, properties, this));
+ return cacheOwner.create(() -> {
+ // Sibling properties can arrive from table metadata after the
gateway's CREATE/ALTER checks.
+ // Validate before provider.create, which may initialize a
driver-loading connector.
+ ConnectorSecuritySurface surface =
ConnectorFactory.findProvider(catalogType, properties)
+
.map(ConnectorProvider::securitySurface).orElse(ConnectorSecuritySurface.EMPTY);
+ try {
+
DefaultConnectorValidationContext.validateJdbcDriverUrls(surface, properties);
+ } catch (DdlException e) {
+ throw new DorisConnectorException(e.getMessage(), e);
+ }
+ return ConnectorFactory.createConnector(catalogType, properties,
this);
+ });
}
@Override
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/connector/DefaultConnectorValidationContext.java
b/fe/fe-core/src/main/java/org/apache/doris/connector/DefaultConnectorValidationContext.java
index e794a6207b4..3d5da5bb2ed 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/connector/DefaultConnectorValidationContext.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/connector/DefaultConnectorValidationContext.java
@@ -21,8 +21,10 @@ import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.JdbcResource;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.FeConstants;
+import org.apache.doris.connector.spi.ConnectorSecuritySurface;
import org.apache.doris.connector.spi.ConnectorValidationContext;
import org.apache.doris.datasource.CatalogProperty;
+import org.apache.doris.foundation.security.JdbcDriverUrlSecurity;
import org.apache.doris.proto.InternalService.PJdbcTestConnectionRequest;
import org.apache.doris.proto.InternalService.PJdbcTestConnectionResult;
import org.apache.doris.rpc.BackendServiceProxy;
@@ -33,6 +35,7 @@ import org.apache.doris.thrift.TStatusCode;
import com.google.protobuf.ByteString;
+import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@@ -82,6 +85,33 @@ public class DefaultConnectorValidationContext implements
ConnectorValidationCon
return JdbcResource.getFullDriverUrl(driverUrl);
}
+ /** Applies mandatory and operator JDBC driver policies to a connector's
declared active URLs. */
+ public static void validateJdbcDriverUrls(ConnectorSecuritySurface surface,
+ Map<String, String> properties) throws DdlException {
+ String flavorKey = surface.jdbcDriverUrlFlavorKey();
+ if (flavorKey != null) {
+ String flavor = properties.get(flavorKey);
+ // Property binding trims strings; policy selection must recognize
the same JDBC flavor.
+ if (flavor == null || !"jdbc".equalsIgnoreCase(flavor.trim())) {
+ return;
+ }
+ }
+ for (String key : surface.jdbcDriverUrlKeys()) {
+ String driverUrl = properties.get(key);
+ if (driverUrl == null || driverUrl.trim().isEmpty()) {
+ continue;
+ }
+ try {
+ String normalizedUrl = driverUrl.trim();
+ // The mandatory rule still applies when the operator's secure
path is a wildcard.
+ JdbcDriverUrlSecurity.check(normalizedUrl);
+ JdbcResource.getFullDriverUrl(normalizedUrl);
+ } catch (Exception e) {
+ throw new DdlException(e.getMessage(), e);
+ }
+ }
+ }
+
@Override
public String computeDriverChecksum(String driverUrl) throws Exception {
return JdbcResource.computeObjectChecksum(driverUrl);
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/plugin/PluginDrivenExternalCatalog.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/plugin/PluginDrivenExternalCatalog.java
index 92697fa14b4..ce9c49a25cc 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/datasource/plugin/PluginDrivenExternalCatalog.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/datasource/plugin/PluginDrivenExternalCatalog.java
@@ -20,7 +20,6 @@ package org.apache.doris.datasource.plugin;
import org.apache.doris.analysis.ColumnPath;
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.Env;
-import org.apache.doris.catalog.JdbcResource;
import org.apache.doris.catalog.TableIf;
import org.apache.doris.catalog.info.ColumnPosition;
import org.apache.doris.catalog.info.CreateOrReplaceBranchInfo;
@@ -75,7 +74,6 @@ import
org.apache.doris.datasource.connector.converter.ConnectorPartitionFieldCo
import org.apache.doris.datasource.log.ExternalObjectLog;
import org.apache.doris.datasource.log.InitCatalogLog;
import org.apache.doris.foundation.property.StoragePropertiesException;
-import org.apache.doris.foundation.security.JdbcDriverUrlSecurity;
import org.apache.doris.fs.FileSystemFactory;
import org.apache.doris.nereids.trees.plans.commands.info.AddPartitionFieldOp;
import org.apache.doris.nereids.trees.plans.commands.info.CreateTableInfo;
@@ -328,29 +326,7 @@ public class PluginDrivenExternalCatalog extends
ExternalCatalog {
if (!touched) {
return;
}
- if (flavorKey != null
- && !"jdbc".equalsIgnoreCase(candidate.getOrDefault(flavorKey,
""))) {
- // A driver_url on a REST/HMS/filesystem catalog stays the dead
config it always was.
- return;
- }
- for (String key : urlKeys) {
- String driverUrl = candidate.get(key);
- if (driverUrl == null || driverUrl.trim().isEmpty()) {
- continue;
- }
- try {
- // The mandatory rule normally runs inside the connector's
property holder; repeated
- // here so the rule holds even under jdbc_driver_secure_path=*
(which getFullDriverUrl
- // accepts wholesale), and because the ALTER path never runs
preCreateValidation.
- JdbcDriverUrlSecurity.check(driverUrl);
- JdbcResource.getFullDriverUrl(driverUrl);
- } catch (Exception e) {
- // getFullDriverUrl throws IllegalArgumentException for policy
rejections but also bare
- // RuntimeException for a missing/undownloadable bare-name
jar; every failure must become
- // the DdlException this validation hook promises.
- throw new DdlException(e.getMessage(), e);
- }
- }
+ DefaultConnectorValidationContext.validateJdbcDriverUrls(surface,
candidate);
}
/**
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/connector/DefaultConnectorContextSiblingTest.java
b/fe/fe-core/src/test/java/org/apache/doris/connector/DefaultConnectorContextSiblingTest.java
index ac1ac5f2cdf..ccdbec405cf 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/connector/DefaultConnectorContextSiblingTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/connector/DefaultConnectorContextSiblingTest.java
@@ -17,15 +17,21 @@
package org.apache.doris.connector;
+import org.apache.doris.common.Config;
import org.apache.doris.connector.spi.Connector;
import org.apache.doris.connector.spi.ConnectorContext;
import org.apache.doris.connector.spi.ConnectorMetadata;
import org.apache.doris.connector.spi.ConnectorProvider;
+import org.apache.doris.connector.spi.ConnectorSecuritySurface;
import org.apache.doris.connector.spi.ConnectorSession;
+import org.apache.doris.connector.spi.DorisConnectorException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
import java.util.HashMap;
import java.util.Map;
@@ -36,13 +42,25 @@ import java.util.Map;
* {@link ConnectorFactory}/{@link ConnectorPluginManager} (so the sibling
loads in the requested type's own plugin
* classloader) and pass THIS context through unchanged (so the sibling reuses
the caller catalog's id/auth/storage).
*
- * <p>Dormant: no production code calls {@code createSiblingConnector} yet
(the hive gateway substep does), so this
- * only exercises the seam in isolation with a recording fake provider
registered on the shared manager.
+ * <p>Recording providers also verify that driver policy failures happen
before a sibling is constructed.
*/
public class DefaultConnectorContextSiblingTest {
+ private String savedSecurePath;
+ private String[] savedWhiteList;
+
+ @BeforeEach
+ void setUp() {
+ savedSecurePath = Config.jdbc_driver_secure_path;
+ savedWhiteList = Config.jdbc_driver_url_white_list;
+ Config.jdbc_driver_secure_path = "*";
+ Config.jdbc_driver_url_white_list = new String[0];
+ }
+
@AfterEach
void tearDown() {
+ Config.jdbc_driver_secure_path = savedSecurePath;
+ Config.jdbc_driver_url_white_list = savedWhiteList;
// The plugin manager is a process-wide static; reset it so this test
does not leak the recording fake
// provider into any other test that shares the ConnectorFactory
singleton.
ConnectorFactory.clearPluginManager();
@@ -97,12 +115,125 @@ public class DefaultConnectorContextSiblingTest {
Assertions.assertNull(sibling, "uninitialized plugin manager must
yield null, not an exception");
}
+ @ParameterizedTest
+ @CsvSource({"paimon,paimon.jdbc.driver_url", "paimon,jdbc.driver_url",
+ "iceberg,iceberg.jdbc.driver_url", "jdbc,driver_url",
"jdbc,jdbc.driver_url"})
+ void siblingRejectsDriverOutsideOperatorSecurePath(String type, String
key) {
+ Config.jdbc_driver_secure_path = "/opt/doris/jdbc_drivers";
+ RecordingProvider provider = registerDriverProvider(type);
+ Map<String, String> properties = driverProperties(type, key,
"https://drivers.example/probe.jar");
+
+ DorisConnectorException failure =
Assertions.assertThrows(DorisConnectorException.class,
+ () -> new DefaultConnectorContext("gateway",
42L).createSiblingConnector(type, properties));
+
+ Assertions.assertTrue(failure.getMessage().contains("allowed paths"),
failure.getMessage());
+ Assertions.assertNull(provider.lastConnector, "rejected properties
must never reach provider.create");
+ }
+
+ @ParameterizedTest
+ @CsvSource({"paimon.jdbc.driver_url,file:///opt/drivers/../probe.jar",
+ "jdbc.driver_url,file:///opt/drivers/%2e%2e/probe.jar",
+ "paimon.jdbc.driver_url,bad name.jar",
"jdbc.driver_url,subdir/probe.jar"})
+ void siblingRejectsUnsafeDriverEvenWithWildcardSecurePath(String key,
String driverUrl) {
+ RecordingProvider provider = registerDriverProvider("paimon");
+ Map<String, String> properties = driverProperties("paimon", key,
driverUrl);
+
+ DorisConnectorException failure =
Assertions.assertThrows(DorisConnectorException.class,
+ () -> new DefaultConnectorContext("gateway",
42L).createSiblingConnector("paimon", properties));
+
+ Assertions.assertTrue(failure.getMessage().contains("Invalid
driver_url"), failure.getMessage());
+ Assertions.assertNull(provider.lastConnector);
+ }
+
+ @Test
+ void siblingRejectsDriverOutsideOperatorWhiteList() {
+ Config.jdbc_driver_url_white_list = new String[]
{"https://drivers.example/allowed.jar"};
+ RecordingProvider provider = registerDriverProvider("paimon");
+ Map<String, String> properties = driverProperties(
+ "paimon", "paimon.jdbc.driver_url",
"https://drivers.example/probe.jar");
+
+ Assertions.assertThrows(DorisConnectorException.class,
+ () -> new DefaultConnectorContext("gateway",
42L).createSiblingConnector("paimon", properties));
+ Assertions.assertNull(provider.lastConnector);
+ }
+
+ @Test
+ void siblingChecksTheNormalizedJdbcFlavor() {
+ Config.jdbc_driver_secure_path = "/opt/doris/jdbc_drivers";
+ RecordingProvider provider = registerDriverProvider("paimon");
+ Map<String, String> properties = driverProperties(
+ "paimon", "paimon.jdbc.driver_url",
"https://drivers.example/probe.jar");
+ properties.put("paimon.catalog.type", " JDBC ");
+
+ Assertions.assertThrows(DorisConnectorException.class,
+ () -> new DefaultConnectorContext("gateway",
42L).createSiblingConnector("paimon", properties));
+ Assertions.assertNull(provider.lastConnector);
+ }
+
+ @Test
+ void siblingAcceptsDriverAllowedByBothOperatorPolicies() {
+ String driverUrl = "https://drivers.example/allowed.jar";
+ Config.jdbc_driver_secure_path = "https://drivers.example/";
+ Config.jdbc_driver_url_white_list = new String[] {driverUrl};
+ RecordingProvider provider = registerDriverProvider("paimon");
+ Map<String, String> properties = driverProperties("paimon",
"paimon.jdbc.driver_url", driverUrl);
+ properties.put("paimon.catalog.type", " JDBC ");
+ properties.put("paimon.jdbc.driver_url", " " + driverUrl + " ");
+
+ Connector sibling = new DefaultConnectorContext("gateway",
42L).createSiblingConnector("paimon", properties);
+
+ Assertions.assertNotNull(sibling);
+ Assertions.assertSame(provider.lastConnector, sibling);
+ Assertions.assertSame(properties, provider.lastProperties);
+ }
+
+ @Test
+ void siblingIgnoresInactiveAndAbsentDriverUrls() {
+ Config.jdbc_driver_secure_path = "/opt/doris/jdbc_drivers";
+ registerDriverProvider("paimon");
+ Map<String, String> properties = driverProperties(
+ "paimon", "paimon.jdbc.driver_url",
"https://drivers.example/unused.jar");
+ properties.put("paimon.catalog.type", "filesystem");
+ Assertions.assertNotNull(new DefaultConnectorContext("gateway", 42L)
+ .createSiblingConnector("paimon", properties));
+
+ properties.clear();
+ properties.put("paimon.catalog.type", "jdbc");
+ Assertions.assertNotNull(new DefaultConnectorContext("gateway", 43L)
+ .createSiblingConnector("paimon", properties));
+ }
+
+ private static Map<String, String> driverProperties(String type, String
key, String driverUrl) {
+ Map<String, String> properties = new HashMap<>();
+ properties.put(type + ".catalog.type", "jdbc");
+ properties.put(key, driverUrl);
+ return properties;
+ }
+
+ private static RecordingProvider registerDriverProvider(String type) {
+ RecordingProvider provider = new RecordingProvider(type);
+ if ("paimon".equals(type)) {
+ provider.surface = ConnectorSecuritySurface.ofJdbcDriverUrls(
+ "paimon.catalog.type", "paimon.jdbc.driver_url",
"jdbc.driver_url");
+ } else if ("iceberg".equals(type)) {
+ provider.surface = ConnectorSecuritySurface.ofJdbcDriverUrls(
+ "iceberg.catalog.type", "iceberg.jdbc.driver_url");
+ } else {
+ provider.surface = ConnectorSecuritySurface.ofJdbcDriverUrls(null,
"driver_url", "jdbc.driver_url");
+ }
+ ConnectorPluginManager manager = new ConnectorPluginManager();
+ manager.registerProvider(provider);
+ ConnectorFactory.initPluginManager(manager);
+ return provider;
+ }
+
/** A ConnectorProvider that records the exact args of its last {@code
create} call and the connector it made. */
private static final class RecordingProvider implements ConnectorProvider {
private final String type;
private Map<String, String> lastProperties;
private ConnectorContext lastContext;
private Connector lastConnector;
+ private ConnectorSecuritySurface surface =
ConnectorSecuritySurface.EMPTY;
RecordingProvider(String type) {
this.type = type;
@@ -113,6 +244,11 @@ public class DefaultConnectorContextSiblingTest {
return type;
}
+ @Override
+ public ConnectorSecuritySurface securitySurface() {
+ return surface;
+ }
+
@Override
public Connector create(Map<String, String> properties,
ConnectorContext context) {
this.lastProperties = properties;
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/plugin/PluginDrivenExternalCatalogDriverUrlGateTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/plugin/PluginDrivenExternalCatalogDriverUrlGateTest.java
index 9b2a5f75894..17ba76a8445 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/plugin/PluginDrivenExternalCatalogDriverUrlGateTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/plugin/PluginDrivenExternalCatalogDriverUrlGateTest.java
@@ -145,6 +145,18 @@ public class PluginDrivenExternalCatalogDriverUrlGateTest {
"http://attacker.test/evil.jar")));
}
+ @Test
+ public void alterRejectsDriverUrlWithPaddedJdbcFlavor() {
+ Map<String, String> stored = props("paimon", "paimon.jdbc.driver_url",
+ "file://" + ALLOWED_DIR + "/mysql.jar");
+ stored.put("paimon.catalog.type", " JDBC ");
+ TestCatalog catalog = new TestCatalog(stored);
+
+ Assertions.assertThrows(DdlException.class,
+ () -> catalog.validatePropertiesBeforeUpdate(stored,
+ Collections.singletonMap("paimon.jdbc.driver_url",
"https://drivers.example/probe.jar")));
+ }
+
@Test
public void alterRejectsJdbcPrefixedAliasDriverUrl() {
// The holder strips the "jdbc." prefix, short spelling winning when
both are present — so with
diff --git
a/regression-test/suites/external_table_p0/fluss/test_fluss_lake_override.groovy
b/regression-test/suites/external_table_p0/fluss/test_fluss_lake_override.groovy
index baa2033a7dc..2e824388613 100644
---
a/regression-test/suites/external_table_p0/fluss/test_fluss_lake_override.groovy
+++
b/regression-test/suites/external_table_p0/fluss/test_fluss_lake_override.groovy
@@ -109,6 +109,16 @@ suite("test_fluss_lake_override", "p0,external") {
"""
order_qt_flavor_only_lake """select count(*) from
${flavorCatalog}.fluss_test.lake_log\$lake"""
+ // The translated metastore is gateway-owned; a nested option must not
switch the sibling to JDBC.
+ sql """alter catalog ${flavorCatalog} set properties (
+ "fluss.lake.paimon.paimon.catalog.type" = "jdbc")"""
+ test {
+ sql """select * from ${flavorCatalog}.fluss_test.lake_log\$lake"""
+ exception "Lake option 'paimon.catalog.type' is reserved"
+ }
+ sql """alter catalog ${flavorCatalog} set properties (
+ "fluss.lake.paimon.paimon.catalog.type" = "")"""
+
// --- an override that is wrong has to be wrong on both paths
--------------
// A warehouse that holds no such table, which is a location nothing could
have
// written -- so if either read still succeeds, that read never saw the
override.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]