This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.2
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.2 by this push:
new e593ebc13e8 branch-4.2: [fix](jdbc) Validate MySQL connection options
in catalog DDL (#71374)
e593ebc13e8 is described below
commit e593ebc13e89bcfe4d76cf329013495808847ac2
Author: Calvin Kirs <[email protected]>
AuthorDate: Fri Dec 4 09:00:17 2026 +0800
branch-4.2: [fix](jdbc) Validate MySQL connection options in catalog DDL
(#71374)
https://github.com/apache/doris/pull/71221
---
.../main/java/org/apache/doris/common/Config.java | 13 ++
.../common/security/JdbcCatalogUrlSecurity.java | 31 +++
.../java/org/apache/doris/common/ConfigTest.java | 30 ++-
.../security/JdbcCatalogUrlSecurityTest.java | 132 +++++++++++++
.../apache/doris/datasource/CatalogFactory.java | 2 +-
.../org/apache/doris/datasource/CatalogMgr.java | 9 +-
.../doris/datasource/jdbc/JdbcExternalCatalog.java | 50 ++++-
.../apache/doris/datasource/CatalogMgrTest.java | 88 +++++++++
.../datasource/jdbc/JdbcExternalCatalogTest.java | 67 +++++++
.../foundation/security/JdbcDriverUrlSecurity.java | 214 +++++++++++++++++++++
.../security/JdbcDriverUrlSecurityTest.java | 64 ++++++
.../org/apache/doris/regression/Config.groovy | 13 ++
.../create_view_nereids_fix_null.groovy | 2 +-
.../jdbc/test_doris_jdbc_catalog.groovy | 2 +-
.../test_doris_jdbc_catalog_query_bitmap.groovy | 2 +-
.../external_table_p0/jdbc/test_jdbc_call.groovy | 2 +-
.../jdbc/test_jni_complex_type.groovy | 2 +-
.../test_mysql_jdbc_catalog_table_comment.groovy | 2 +-
.../jdbc/test_non_nullable_jdbc_mtmv.groovy | 2 +-
.../jdbc/test_query_tvf_cross_catalog.groovy | 2 +-
.../select/test_doris_all_types_select.groovy | 2 +-
.../lower_case/test_conflict_name.groovy | 2 +-
.../lower_case/test_lower_case_meta_include.groovy | 2 +-
.../test_lower_case_meta_show_and_select.groovy | 2 +-
...er_case_meta_with_lower_table_conf_grant.groovy | 2 +-
...ta_with_lower_table_conf_show_and_select.groovy | 2 +-
.../lower_case/test_lower_case_mtmv.groovy | 2 +-
.../test_meta_cache_select_without_refresh.groovy | 2 +-
.../lower_case/test_meta_names_mapping.groovy | 2 +-
.../lower_case/test_timing_refresh_catalog.groovy | 2 +-
.../lower_case/upgrade/load.groovy | 2 +-
.../suites/nereids_syntax_p0/alias_conflict.groovy | 2 +-
.../test_cloud_plugin_auto_download.groovy | 2 +-
.../test_ranger_access_resource_catalog.groovy | 2 +-
.../test_ranger_access_resource_global.groovy | 2 +-
...test_ranger_access_role_resource_catalog.groovy | 2 +-
36 files changed, 730 insertions(+), 31 deletions(-)
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
index 50e1990ea4a..cdc4b745517 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
@@ -198,6 +198,19 @@ public class Config extends ConfigBase {
+ "are matched structurally, so path traversal and prefix
confusion are rejected."})
public static String jdbc_driver_secure_path = "*";
+ @ConfField(description = {
+ "CREATE CATALOG 和 ALTER CATALOG 设置实际使用的 URL 时受限的 MySQL JDBC URL
参数名。"
+ + "参数名以逗号分隔,不区分大小写。FE 启动时加载此配置,fe_custom.conf 优先于 fe.conf,"
+ + "更改后需要重启 FE。默认的两个 LOCAL INFILE 开关只允许禁用值,目录参数只允许空值,"
+ + "其余列出的参数均被拒绝。",
+ "Comma-separated, case-insensitive MySQL JDBC URL parameter names
restricted during CREATE CATALOG "
+ + "and when ALTER CATALOG sets the effective URL. The list
is loaded at FE startup, with "
+ + "fe_custom.conf overriding fe.conf. Changes require an
FE restart. The two default LOCAL "
+ + "INFILE flags only allow disabled values, the directory
option only allows an empty value, "
+ + "and other listed names are blocked."})
+ public static String[] jdbc_mysql_restricted_url_parameters = {
+ "allowLoadLocalInfile", "allowUrlInLocalInfile",
"allowLoadLocalInfileInPath"};
+
@ConfField(description = {"MySQL Jdbc Catalog mysql 不支持下推的函数",
"MySQL Jdbc Catalog mysql does not support pushdown functions"})
public static String[] jdbc_mysql_unsupported_pushdown_functions =
{"date_trunc", "money_format", "negative"};
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/common/security/JdbcCatalogUrlSecurity.java
b/fe/fe-common/src/main/java/org/apache/doris/common/security/JdbcCatalogUrlSecurity.java
new file mode 100644
index 00000000000..c86115e8bbe
--- /dev/null
+++
b/fe/fe-common/src/main/java/org/apache/doris/common/security/JdbcCatalogUrlSecurity.java
@@ -0,0 +1,31 @@
+// 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.common.security;
+
+import org.apache.doris.common.Config;
+import org.apache.doris.foundation.security.JdbcDriverUrlSecurity;
+
+/** Applies the FE configuration to the MySQL JDBC catalog URL. */
+public final class JdbcCatalogUrlSecurity {
+ private JdbcCatalogUrlSecurity() {
+ }
+
+ public static String prepareMySqlJdbcUrl(String url) {
+ return JdbcDriverUrlSecurity.prepareMySqlJdbcUrl(url,
Config.jdbc_mysql_restricted_url_parameters);
+ }
+}
diff --git a/fe/fe-common/src/test/java/org/apache/doris/common/ConfigTest.java
b/fe/fe-common/src/test/java/org/apache/doris/common/ConfigTest.java
index 38c47953c6d..7f0749dca4c 100644
--- a/fe/fe-common/src/test/java/org/apache/doris/common/ConfigTest.java
+++ b/fe/fe-common/src/test/java/org/apache/doris/common/ConfigTest.java
@@ -265,14 +265,40 @@ public class ConfigTest {
Assert.assertEquals("array length should be 0", 0,
Config.mysql_compat_var_whitelist.length);
}
- // File-path and jdbc-driver security configs must only be settable in
fe.conf (ops), never at runtime
- // via ADMIN SET FRONTEND CONFIG. setMutableConfig is exactly that runtime
entrypoint, so it must reject them.
+ @Test
+ public void testMysqlRestrictedUrlParametersUseCustomStartupOverride()
throws Exception {
+ String[] original = Config.jdbc_mysql_restricted_url_parameters;
+ String originalDriverPath = Config.jdbc_driver_secure_path;
+ try {
+ Assertions.assertArrayEquals(new String[] {
+ "allowLoadLocalInfile", "allowUrlInLocalInfile",
"allowLoadLocalInfileInPath"}, original);
+ Config config = new Config();
+ config.init(configFile("jdbc_mysql_restricted_url_parameters=
connectTimeout , socketTimeout \n")
+ .toString());
+ Assertions.assertArrayEquals(new String[] {"connectTimeout",
"socketTimeout"},
+ Config.jdbc_mysql_restricted_url_parameters);
+
+
config.initCustom(configFile("jdbc_mysql_restricted_url_parameters=
connectionTimeZone , useUnicode \n"
+ +
"jdbc_driver_secure_path=${java.io.tmpdir}/custom-drivers\n").toString());
+ Assertions.assertArrayEquals(new String[] {"connectionTimeZone",
"useUnicode"},
+ Config.jdbc_mysql_restricted_url_parameters);
+ Assertions.assertEquals(System.getProperty("java.io.tmpdir") +
"/custom-drivers",
+ Config.jdbc_driver_secure_path);
+ } finally {
+ Config.jdbc_mysql_restricted_url_parameters = original;
+ Config.jdbc_driver_secure_path = originalDriverPath;
+ }
+ }
+
+ // File-path and JDBC security configs are set at startup. ADMIN SET
FRONTEND CONFIG uses
+ // setMutableConfig, which must reject runtime changes to them.
@Test
public void testSecurityPathConfigsAreNotRuntimeMutable() {
String[] opsOnlyConfigs = {
"jdbc_driver_url_white_list",
"jdbc_drivers_dir",
"jdbc_driver_secure_path",
+ "jdbc_mysql_restricted_url_parameters",
"tmp_dir",
"plugin_dir",
"s3_load_endpoint_white_list",
diff --git
a/fe/fe-common/src/test/java/org/apache/doris/common/security/JdbcCatalogUrlSecurityTest.java
b/fe/fe-common/src/test/java/org/apache/doris/common/security/JdbcCatalogUrlSecurityTest.java
new file mode 100644
index 00000000000..590c761fcb3
--- /dev/null
+++
b/fe/fe-common/src/test/java/org/apache/doris/common/security/JdbcCatalogUrlSecurityTest.java
@@ -0,0 +1,132 @@
+// 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.common.security;
+
+import org.apache.doris.common.Config;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class JdbcCatalogUrlSecurityTest {
+ private static final String MYSQL_URL = "jdbc:mysql://db.example/app?";
+
+ @Test
+ public void testAllowsSafeMysqlPropertiesAndOtherDrivers() {
+
JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl("jdbc:mysql://db.example/app");
+ JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(MYSQL_URL +
"connectTimeout=5000&allowLoadLocalInfile=false"
+ + "&allowUrlInLocalInfile=NO&allowLoadLocalInfileInPath=");
+ JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(MYSQL_URL +
"connectionAttributes=label:sample%3Dvalue");
+
JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl("jdbc:mysql://address=(host=db.example)(port=3306)"
+ +
"(allowLoadLocalInfile=false)(allowLoadLocalInfileInPath=)/app");
+
JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl("jdbc:mysql:replication://[::1]:3306,(host=db.example,port=3306,"
+ + "allowUrlInLocalInfile=false)/app");
+ String postgresUrl =
"jdbc:postgresql://db.example/app?connectTimeout=5";
+ Assertions.assertEquals(postgresUrl,
JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(postgresUrl));
+ }
+
+ @Test
+ public void testRejectsRawClosingParenthesisInQuotedLegacyHostPassword() {
+ String url =
"jdbc:mysql://address=(host=db.example)(password='p(a)ss')/app";
+ IllegalArgumentException error =
Assertions.assertThrows(IllegalArgumentException.class,
+ () -> JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(url));
+ Assertions.assertEquals("Invalid MySQL jdbc_url host properties",
error.getMessage());
+ }
+
+ @Test
+ public void testPreservesQuotedLegacyHostPassword() {
+ String url =
"jdbc:mysql://address=(host=db.example)(password='sample')/app";
+ Assertions.assertEquals(url + "?allowLoadLocalInfile=false",
+ JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(url));
+ }
+
+ @Test
+ public void testAllowsQuotedDisabledLegacyHostOption() {
+ String url =
"jdbc:mysql://address=(host=db.example)(allowLoadLocalInfile=\"false\")/app";
+ Assertions.assertEquals(url + "?allowLoadLocalInfile=false",
+ JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(url));
+ }
+
+ @Test
+ public void testRejectsMalformedRestrictedBooleanValues() {
+ assertMySqlOptionRejected(MYSQL_URL + "allowLoadLocalInfile=maybe",
"allowLoadLocalInfile");
+ assertMySqlOptionRejected(MYSQL_URL + "ALLOWURLINLOCALINFILE=",
"allowUrlInLocalInfile");
+ }
+
+ @Test
+ public void testMalformedMysqlOptionErrorsOmitUrlValues() {
+ IllegalArgumentException error =
Assertions.assertThrows(IllegalArgumentException.class,
+ () -> JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(MYSQL_URL +
"allowLoadLocalInfile=%invalid"));
+ Assertions.assertEquals("Invalid percent encoding in MySQL jdbc_url",
error.getMessage());
+ }
+
+ @Test
+ public void testUsesConfiguredMysqlRestrictionsForGlobalAndHostOptions() {
+ String[] original = Config.jdbc_mysql_restricted_url_parameters;
+ try {
+ JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(MYSQL_URL +
"connectTimeout=1000");
+ Config.jdbc_mysql_restricted_url_parameters = new String[]
{"allowLoadLocalInfile", "connectTimeout"};
+ assertMySqlOptionRejected(MYSQL_URL + "CONNECTTIMEOUT=1000",
"connectTimeout");
+
assertMySqlOptionRejected("jdbc:mysql://address=(host=db.example)(connectTimeout=1000)/app",
+ "connectTimeout");
+ assertMySqlOptionRejected("jdbc:mysql:loadbalance://db.example,"
+ + "(host=replica.example,connectTimeout=1000)/app",
"connectTimeout");
+ assertMySqlOptionRejected(MYSQL_URL +
"allowLoadLocalInfile=maybe", "allowLoadLocalInfile");
+ JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(MYSQL_URL +
"allowLoadLocalInfile=false");
+ JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(MYSQL_URL +
"socketTimeout=1000");
+ } finally {
+ Config.jdbc_mysql_restricted_url_parameters = original;
+ }
+ }
+
+ @Test
+ public void testPreparesCanonicalMysqlDefault() {
+ Assertions.assertEquals(MYSQL_URL + "allowLoadLocalInfile=false",
+
JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl("jdbc:mysql://db.example/app#catalog-note"));
+ Assertions.assertEquals(MYSQL_URL + "allowLoadLocalInfile=NO",
+ JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(MYSQL_URL +
"allowLoadLocalInfile=NO"));
+ }
+
+ @Test
+ public void testPreservesSpacesOutsideMysqlPolicyEdits() {
+ String url = MYSQL_URL + "password=example value";
+ Assertions.assertEquals(MYSQL_URL +
"allowLoadLocalInfile=false&password=example value#catalog-note",
+ JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(url +
"#catalog-note"));
+ String explicit = url + "&allowLoadLocal Infile = false";
+ Assertions.assertEquals(explicit,
JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(explicit));
+ Assertions.assertEquals(url + "& allowLoadLocalInfile=false",
+ JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(url + "& "));
+ assertMySqlOptionRejected(MYSQL_URL + "allowLoadLocal Infile = maybe",
"allowLoadLocalInfile");
+ }
+
+ @Test
+ public void testChecksAliasesInMysqlHostProperties() {
+ String[] original = Config.jdbc_mysql_restricted_url_parameters;
+ try {
+ Config.jdbc_mysql_restricted_url_parameters = new String[]
{"connectionTimeZone"};
+
assertMySqlOptionRejected("jdbc:mysql://(host=db.example,serverTimezone=UTC)/app",
"connectionTimeZone");
+ } finally {
+ Config.jdbc_mysql_restricted_url_parameters = original;
+ }
+ }
+
+ private static void assertMySqlOptionRejected(String url, String
optionName) {
+ IllegalArgumentException error =
Assertions.assertThrows(IllegalArgumentException.class,
+ () -> JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(url));
+ Assertions.assertEquals("MySQL jdbc_url disallows " + optionName,
error.getMessage());
+ }
+}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogFactory.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogFactory.java
index e063329be04..c9254f82582 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogFactory.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogFactory.java
@@ -94,7 +94,7 @@ public class CatalogFactory {
catalog = new EsExternalCatalog(catalogId, name, resource,
props, comment);
break;
case "jdbc":
- catalog = new JdbcExternalCatalog(catalogId, name, resource,
props, comment);
+ catalog = new JdbcExternalCatalog(catalogId, name, resource,
props, comment, isReplay);
break;
case "iceberg":
catalog =
IcebergExternalCatalogFactory.createCatalog(catalogId, name, resource, props,
comment);
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
index 8019ce33fd4..326e693ea00 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
@@ -43,6 +43,7 @@ import org.apache.doris.datasource.hive.HMSExternalCatalog;
import org.apache.doris.datasource.hive.HMSExternalDatabase;
import org.apache.doris.datasource.hive.HMSExternalTable;
import org.apache.doris.datasource.hive.HiveExternalMetaCache;
+import org.apache.doris.datasource.jdbc.JdbcExternalCatalog;
import org.apache.doris.datasource.lance.LanceExternalCatalog;
import org.apache.doris.datasource.mvcc.MvccUtil;
import org.apache.doris.mysql.privilege.PrivPredicate;
@@ -459,10 +460,14 @@ public class CatalogMgr implements Writable,
GsonPostProcessable {
} finally {
readUnlock();
}
+ Map<String, String> preparedProperties = newProperties;
+ if (catalog instanceof JdbcExternalCatalog) {
+ preparedProperties =
JdbcExternalCatalog.prepareAlterUrlProperties(oldProperties, newProperties);
+ }
if (catalog instanceof ExternalCatalog) {
// Checks that may block on the network (the SSRF endpoint
probe) must not hold the global catalog
// write lock: run them on the snapshot, and apply below only
if no other DDL changed it meanwhile.
- ((ExternalCatalog)
catalog).validatePropertiesBeforeUpdateUnlocked(oldProperties, newProperties);
+ ((ExternalCatalog)
catalog).validatePropertiesBeforeUpdateUnlocked(oldProperties,
preparedProperties);
}
writeLock();
try {
@@ -471,7 +476,7 @@ public class CatalogMgr implements Writable,
GsonPostProcessable {
// The catalog was replaced or altered after the snapshot:
check the current one again.
continue;
}
- alterCatalogPropsLocked(catalog, newProperties, oldProperties);
+ alterCatalogPropsLocked(catalog, preparedProperties,
oldProperties);
return;
} finally {
writeUnlock();
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java
index a418ec9f0f0..23bd40fb505 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalog.java
@@ -26,6 +26,7 @@ import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.FeConstants;
+import org.apache.doris.common.security.JdbcCatalogUrlSecurity;
import org.apache.doris.datasource.CatalogProperty;
import org.apache.doris.datasource.ExternalCatalog;
import org.apache.doris.datasource.ExternalDatabase;
@@ -68,6 +69,7 @@ import java.util.concurrent.Future;
public class JdbcExternalCatalog extends ExternalCatalog {
private static final Logger LOG =
LogManager.getLogger(JdbcExternalCatalog.class);
+ private static final String JDBC_URL_ALIAS =
JdbcResource.JDBC_PROPERTIES_PREFIX + JdbcResource.JDBC_URL;
private static final List<String> REQUIRED_PROPERTIES = ImmutableList.of(
JdbcResource.JDBC_URL,
@@ -84,8 +86,13 @@ public class JdbcExternalCatalog extends ExternalCatalog {
public JdbcExternalCatalog(long catalogId, String name, String resource,
Map<String, String> props,
String comment)
throws DdlException {
+ this(catalogId, name, resource, props, comment, true);
+ }
+
+ public JdbcExternalCatalog(long catalogId, String name, String resource,
Map<String, String> props,
+ String comment, boolean isReplay) throws DdlException {
super(catalogId, name, InitCatalogLog.Type.JDBC, comment);
- this.catalogProperty = new CatalogProperty(resource,
processCompatibleProperties(props));
+ this.catalogProperty = new CatalogProperty(resource,
processCompatibleProperties(props, isReplay));
this.identifierMapping = new JdbcIdentifierMapping(
(Env.isTableNamesCaseInsensitive() ||
Env.isStoredTableNamesLowerCase()),
Boolean.parseBoolean(getLowerCaseMetaNames()),
@@ -186,20 +193,59 @@ public class JdbcExternalCatalog extends ExternalCatalog {
}
}
- protected Map<String, String> processCompatibleProperties(Map<String,
String> props)
+ private Map<String, String> processCompatibleProperties(Map<String,
String> props, boolean isReplay)
throws DdlException {
Map<String, String> properties = Maps.newHashMap();
for (Map.Entry<String, String> kv : props.entrySet()) {
properties.put(StringUtils.removeStart(kv.getKey(),
JdbcResource.JDBC_PROPERTIES_PREFIX), kv.getValue());
}
+ if (props.containsKey(JdbcResource.JDBC_URL)) {
+ // Give the canonical key precedence when both it and the legacy
alias are present.
+ properties.put(JdbcResource.JDBC_URL,
props.get(JdbcResource.JDBC_URL));
+ }
String jdbcUrl = properties.getOrDefault(JdbcResource.JDBC_URL, "");
if (!Strings.isNullOrEmpty(jdbcUrl)) {
+ if (!isReplay) {
+ jdbcUrl = prepareMySqlJdbcUrl(jdbcUrl);
+ }
jdbcUrl = JdbcResource.handleJdbcUrl(jdbcUrl);
properties.put(JdbcResource.JDBC_URL, jdbcUrl);
}
return properties;
}
+ public static Map<String, String> prepareAlterUrlProperties(Map<String,
String> currentProperties,
+ Map<String, String> updates) throws DdlException {
+ String key = JdbcResource.JDBC_URL;
+ if (!updates.containsKey(key)) {
+ // A stored canonical URL continues to shadow the alias.
+ if (currentProperties.containsKey(key) ||
!updates.containsKey(JDBC_URL_ALIAS)) {
+ return updates;
+ }
+ key = JDBC_URL_ALIAS;
+ }
+ String url = updates.get(key);
+ if (url == null) {
+ return updates;
+ }
+ String preparedUrl = prepareMySqlJdbcUrl(url);
+ if (JdbcResource.JDBC_URL.equals(key) && url.equals(preparedUrl)) {
+ return updates;
+ }
+ Map<String, String> prepared = Maps.newHashMap(updates);
+ prepared.remove(key);
+ prepared.put(JdbcResource.JDBC_URL, preparedUrl);
+ return prepared;
+ }
+
+ private static String prepareMySqlJdbcUrl(String jdbcUrl) throws
DdlException {
+ try {
+ return JdbcCatalogUrlSecurity.prepareMySqlJdbcUrl(jdbcUrl);
+ } catch (IllegalArgumentException e) {
+ throw new DdlException(e.getMessage(), e);
+ }
+ }
+
public String getDatabaseTypeName() {
makeSureInitialized();
return jdbcClient.getDbType();
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/CatalogMgrTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/CatalogMgrTest.java
index f631396ea18..76c6fd4e72e 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/datasource/CatalogMgrTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/datasource/CatalogMgrTest.java
@@ -22,6 +22,7 @@ import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.JdbcResource;
import org.apache.doris.catalog.RefreshManager;
import org.apache.doris.catalog.TableIf;
+import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.Pair;
import org.apache.doris.common.util.Util;
@@ -33,10 +34,12 @@ import org.apache.doris.datasource.metacache.MetaCache;
import org.apache.doris.datasource.operations.ExternalMetadataOps;
import org.apache.doris.datasource.paimon.PaimonExternalCatalog;
import org.apache.doris.datasource.property.metastore.AbstractPaimonProperties;
+import org.apache.doris.mysql.privilege.AccessControllerManager;
import org.apache.doris.nereids.exceptions.NotSupportedException;
import org.apache.doris.persist.DropDbInfo;
import org.apache.doris.persist.DropInfo;
import org.apache.doris.persist.EditLog;
+import org.apache.doris.persist.OperationType;
import org.apache.doris.statistics.query.QueryStats;
import com.github.benmanes.caffeine.cache.RemovalCause;
@@ -307,6 +310,91 @@ public class CatalogMgrTest {
Mockito.verify(editLog,
Mockito.never()).logCatalogLog(Mockito.anyShort(), Mockito.any());
}
+ @Test
+ void testMysqlAlterPreparesEffectiveUrlAndReplaysJournal() throws
Exception {
+ String[] original = Config.jdbc_mysql_restricted_url_parameters;
+ String urlKey = JdbcResource.JDBC_URL;
+ String alias = "jdbc." + urlKey;
+ String legacy = "jdbc:mysql://db.invalid/app?connectTimeout=1000";
+ String submitted = "jdbc:mysql://db.invalid/app?socketTimeout=2000";
+ String prepared = submitted + "&allowLoadLocalInfile=false";
+ CatalogLog create = new CatalogLog();
+ create.setCatalogId(98L);
+ create.setCatalogName("jdbc_ctl");
+ create.setProps(ImmutableMap.of("type", "jdbc", urlKey, legacy,
+ JdbcResource.DRIVER_URL, "driver.jar",
JdbcResource.DRIVER_CLASS, "com.mysql.cj.jdbc.Driver"));
+ CatalogMgr catalogMgr = new CatalogMgr();
+ Env env = Mockito.mock(Env.class);
+ ExternalMetaCacheMgr cacheMgr =
Mockito.mock(ExternalMetaCacheMgr.class);
+ EditLog editLog = Mockito.mock(EditLog.class);
+ AccessControllerManager accessManager =
Mockito.mock(AccessControllerManager.class);
+ Mockito.when(env.getAccessManager()).thenReturn(accessManager);
+ Mockito.when(env.getExtMetaCacheMgr()).thenReturn(cacheMgr);
+ Mockito.when(env.getEditLog()).thenReturn(editLog);
+ Mockito.when(cacheMgr.withCatalogLifecycleLock(Mockito.eq(98L),
Mockito.any()))
+ .thenAnswer(invocation ->
invocation.<java.util.function.Supplier<?>>getArgument(1).get());
+
+ try (MockedStatic<Env> mockedEnv = Mockito.mockStatic(Env.class)) {
+ mockedEnv.when(Env::getCurrentEnv).thenReturn(env);
+ Config.jdbc_mysql_restricted_url_parameters = new String[]
{"allowLoadLocalInfile", "connectTimeout"};
+ catalogMgr.replayCreateCatalog(create);
+ JdbcExternalCatalog catalog = (JdbcExternalCatalog)
catalogMgr.getCatalog("jdbc_ctl");
+ String replayedUrl = catalog.getJdbcUrl();
+ Assertions.assertTrue(replayedUrl.startsWith(legacy + "&"));
+
Assertions.assertFalse(replayedUrl.contains("allowLoadLocalInfile"));
+
+ Map<String, String> shadowedAlias = ImmutableMap.of(
+ alias, legacy, JdbcResource.CONNECTION_POOL_MAX_SIZE,
"12");
+ catalogMgr.alterCatalogProps("jdbc_ctl", shadowedAlias);
+ Assertions.assertEquals(replayedUrl, catalog.getJdbcUrl());
+
+ DdlException error = Assertions.assertThrows(DdlException.class,
+ () -> catalogMgr.alterCatalogProps("jdbc_ctl",
ImmutableMap.of(urlKey, legacy)));
+ Assertions.assertEquals("MySQL jdbc_url disallows connectTimeout",
error.getDetailMessage());
+ Assertions.assertEquals(replayedUrl, catalog.getJdbcUrl());
+
+ Map<String, String> updates = ImmutableMap.of(urlKey, submitted,
alias, legacy);
+ catalogMgr.alterCatalogProps("jdbc_ctl", updates);
+ Assertions.assertEquals(prepared, catalog.getJdbcUrl());
+ Assertions.assertEquals(submitted, updates.get(urlKey));
+ ArgumentCaptor<CatalogLog> journal =
ArgumentCaptor.forClass(CatalogLog.class);
+ Mockito.verify(editLog, Mockito.times(2))
+
.logCatalogLog(Mockito.eq(OperationType.OP_ALTER_CATALOG_PROPS),
journal.capture());
+ Assertions.assertEquals(shadowedAlias,
journal.getAllValues().get(0).getNewProps());
+ Assertions.assertEquals(ImmutableMap.of(urlKey, prepared, alias,
legacy), journal.getValue().getNewProps());
+
+ Config.jdbc_mysql_restricted_url_parameters = new String[]
{"socketTimeout"};
+ catalogMgr.replayAlterCatalogProps(journal.getValue(), null, true);
+ Assertions.assertEquals(prepared, catalog.getJdbcUrl());
+ JdbcExternalCatalog rebuilt =
+ (JdbcExternalCatalog)
CatalogFactory.createFromLog(catalog.constructEditLog());
+ Assertions.assertTrue(rebuilt.getJdbcUrl().startsWith(prepared +
"&"));
+
+ Config.jdbc_mysql_restricted_url_parameters = new String[]
{"allowLoadLocalInfile"};
+ JdbcExternalCatalog retryCatalog = Mockito.spy(catalog);
+ retryCatalog.getCatalogProperty().deleteProperty(urlKey);
+ addNamedCatalog(catalogMgr, retryCatalog);
+ String retryUrl = "jdbc:mysql://db.invalid/next";
+ Map<String, String> aliasUpdate = ImmutableMap.of(alias, retryUrl);
+ Mockito.doAnswer(invocation -> {
+ Assertions.assertEquals(ImmutableMap.of(urlKey, retryUrl +
"?allowLoadLocalInfile=false"),
+ invocation.getArgument(1));
+ retryCatalog.getCatalogProperty().addProperty(urlKey,
prepared);
+ return null;
+ }).doAnswer(invocation -> {
+ Assertions.assertEquals(aliasUpdate,
invocation.getArgument(1));
+ return null;
+
}).when(retryCatalog).validatePropertiesBeforeUpdateUnlocked(Mockito.anyMap(),
Mockito.anyMap());
+ catalogMgr.alterCatalogProps("jdbc_ctl", aliasUpdate);
+ Mockito.verify(retryCatalog, Mockito.times(2))
+ .validatePropertiesBeforeUpdateUnlocked(Mockito.anyMap(),
Mockito.anyMap());
+ Assertions.assertEquals(prepared, retryCatalog.getJdbcUrl());
+ Assertions.assertEquals(retryUrl,
retryCatalog.getProperties().get(alias));
+ } finally {
+ Config.jdbc_mysql_restricted_url_parameters = original;
+ }
+ }
+
@Test
void
testDetachedValidationNeverPublishesCandidateToConcurrentInitialization()
throws Exception {
CatalogMgr catalogMgr = new CatalogMgr();
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalogTest.java
b/fe/fe-core/src/test/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalogTest.java
index 9ac97941b5a..c2efe496623 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalogTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/datasource/jdbc/JdbcExternalCatalogTest.java
@@ -17,16 +17,23 @@
package org.apache.doris.datasource.jdbc;
+import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.JdbcResource;
+import org.apache.doris.catalog.ResourceMgr;
+import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.FeConstants;
import org.apache.doris.datasource.CatalogFactory;
import org.apache.doris.datasource.ExternalCatalog;
+import org.apache.doris.nereids.trees.plans.commands.CreateCatalogCommand;
+import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.MockedStatic;
+import org.mockito.Mockito;
import java.util.HashMap;
import java.util.Map;
@@ -82,6 +89,66 @@ public class JdbcExternalCatalogTest {
Assert.assertEquals(original, jdbcExternalCatalog.getProperties());
}
+ @Test
+ public void testMysqlCreatePreparesEffectiveUrl() throws DdlException {
+ String[] original = Config.jdbc_mysql_restricted_url_parameters;
+ try {
+ Config.jdbc_mysql_restricted_url_parameters = new String[]
{"allowLoadLocalInfile", "socketTimeout"};
+ String alias = "jdbc." + JdbcResource.JDBC_URL;
+ String url =
"jdbc:mysql://db.invalid/app?connectTimeout=1000#catalog-note";
+ String restricted =
"jdbc:mysql://db.invalid/app?socketTimeout=2000";
+ Map<String, String> properties = new HashMap<>(ImmutableMap.of(
+ "type", "jdbc", JdbcResource.JDBC_URL, url, alias,
restricted));
+ CreateCatalogCommand create = new CreateCatalogCommand("jdbc_ctl",
false, null, "", properties);
+
+ JdbcExternalCatalog catalog = (JdbcExternalCatalog)
CatalogFactory.createFromCommand(2L, create);
+ String expected =
"jdbc:mysql://db.invalid/app?allowLoadLocalInfile=false&connectTimeout=1000#catalog-note";
+ Assert.assertTrue(catalog.getJdbcUrl().startsWith(expected + "&"));
+
Assert.assertTrue(catalog.getJdbcUrl().contains("yearIsDateType=false"));
+ Assert.assertEquals(catalog.getJdbcUrl(),
catalog.constructEditLog().getProps().get(JdbcResource.JDBC_URL));
+ Assert.assertEquals(url, properties.get(JdbcResource.JDBC_URL));
+
+ properties.remove(JdbcResource.JDBC_URL);
+ DdlException error = Assert.assertThrows(DdlException.class,
+ () -> CatalogFactory.createFromCommand(2L, create));
+ Assert.assertEquals("MySQL jdbc_url disallows socketTimeout",
error.getDetailMessage());
+
+ properties.put(alias, "jdbc:mysql://db.invalid/app");
+ JdbcExternalCatalog fromAlias = (JdbcExternalCatalog)
CatalogFactory.createFromCommand(2L, create);
+ Assert.assertTrue(fromAlias.getJdbcUrl()
+
.startsWith("jdbc:mysql://db.invalid/app?allowLoadLocalInfile=false&"));
+ Assert.assertFalse(fromAlias.getProperties().containsKey(alias));
+
+ Env env = Mockito.mock(Env.class);
+ ResourceMgr resourceMgr = Mockito.mock(ResourceMgr.class);
+ Mockito.when(env.getResourceMgr()).thenReturn(resourceMgr);
+ JdbcResource resource = new JdbcResource("legacy_jdbc");
+
Mockito.when(resourceMgr.getResource("legacy_jdbc")).thenReturn(resource);
+ try (MockedStatic<Env> mockedEnv = Mockito.mockStatic(Env.class)) {
+ mockedEnv.when(Env::getCurrentEnv).thenReturn(env);
+ CreateCatalogCommand fromResource =
+ new CreateCatalogCommand("jdbc_ctl", false,
"legacy_jdbc", "",
+ ImmutableMap.of(alias, restricted));
+ DdlException legacyError =
Assert.assertThrows(DdlException.class,
+ () -> CatalogFactory.createFromCommand(2L,
fromResource));
+ Assert.assertEquals("MySQL jdbc_url disallows socketTimeout",
legacyError.getDetailMessage());
+ }
+ } finally {
+ Config.jdbc_mysql_restricted_url_parameters = original;
+ }
+ }
+
+ @Test
+ public void testMysqlAlterPreparesAliasWhenCanonicalUrlIsAbsent() throws
DdlException {
+ String alias = "jdbc." + JdbcResource.JDBC_URL;
+ String url = "jdbc:mysql://db.invalid/app";
+ Map<String, String> updates = ImmutableMap.of(alias, url);
+ Assert.assertEquals(ImmutableMap.of(JdbcResource.JDBC_URL, url +
"?allowLoadLocalInfile=false"),
+ JdbcExternalCatalog.prepareAlterUrlProperties(
+ ImmutableMap.of(alias, "jdbc:mysql://db.invalid/old"),
updates));
+ Assert.assertEquals(url, updates.get(alias));
+ }
+
@Test
public void replayJdbcCatalogTest() throws DdlException {
jdbcExternalCatalog.getCatalogProperty().addProperty(JdbcResource.CONNECTION_POOL_MIN_SIZE,
"1");
diff --git
a/fe/fe-foundation/src/main/java/org/apache/doris/foundation/security/JdbcDriverUrlSecurity.java
b/fe/fe-foundation/src/main/java/org/apache/doris/foundation/security/JdbcDriverUrlSecurity.java
index fae1b921673..6a0060cb2f0 100644
---
a/fe/fe-foundation/src/main/java/org/apache/doris/foundation/security/JdbcDriverUrlSecurity.java
+++
b/fe/fe-foundation/src/main/java/org/apache/doris/foundation/security/JdbcDriverUrlSecurity.java
@@ -17,8 +17,15 @@
package org.apache.doris.foundation.security;
+import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
@@ -60,6 +67,30 @@ public final class JdbcDriverUrlSecurity {
// This intentionally forbids any path separator, so it can never escape
the drivers directory.
private static final Pattern SAFE_DRIVER_FILE_NAME =
Pattern.compile("^[A-Za-z0-9._-]+\\.jar$");
+ private static final String MYSQL_PREFIX = "jdbc:mysql";
+ private static final Pattern MYSQL_URL_PREFIX =
Pattern.compile("jdbc:mysql[\\w+:%]*\\s*(?<authority>//)?",
+ Pattern.CASE_INSENSITIVE);
+ private static final String ALLOW_LOAD_LOCAL_INFILE =
"allowLoadLocalInfile";
+ private static final String ALLOW_URL_IN_LOCAL_INFILE =
"allowUrlInLocalInfile";
+ private static final String ALLOW_LOAD_LOCAL_INFILE_IN_PATH =
"allowLoadLocalInfileInPath";
+
+ // Classic protocol aliases from Connector/J 8.4 PropertyKey.
+ private static final Map<String, String> MYSQL_OPTION_ALIASES =
Map.ofEntries(
+ Map.entry("namedpipepath", "path"),
+ Map.entry("allowslavedownconnections",
"allowreplicadownconnections"),
+ Map.entry("allowmasterdownconnections",
"allowsourcedownconnections"),
+ Map.entry("servertimezone", "connectiontimezone"),
+ Map.entry("haenablejmx", "ha.enablejmx"),
+ Map.entry("haloadbalancestrategy", "ha.loadbalancestrategy"),
+ Map.entry("loadbalanceblacklisttimeout",
"loadbalanceblocklisttimeout"),
+ Map.entry("nullcatalogmeanscurrent", "nulldatabasemeanscurrent"),
+ Map.entry("queriesbeforeretrymaster", "queriesbeforeretrysource"),
+ Map.entry("parseinfocachefactory", "queryinfocachefactory"),
+ Map.entry("readfrommasterwhennoslaves",
"readfromsourcewhennoreplicas"),
+ Map.entry("secondsbeforeretrymaster", "secondsbeforeretrysource"),
+ Map.entry("enabledsslciphersuites", "tlsciphersuites"),
+ Map.entry("enabledtlsprotocols", "tlsversions"));
+
private JdbcDriverUrlSecurity() {
}
@@ -99,4 +130,187 @@ public final class JdbcDriverUrlSecurity {
}
}
}
+
+ /** Validates a MySQL catalog URL and prepares it for Connector/J versions
with different defaults. */
+ public static String prepareMySqlJdbcUrl(String url, String[]
restrictedOptionNames) {
+ if (url == null) {
+ return null;
+ }
+ // Check the same space-stripped URL the connector will use, while
retaining the original text.
+ String jdbcUrl = url.replace(" ", "").trim();
+ if (!jdbcUrl.regionMatches(true, 0, MYSQL_PREFIX, 0,
MYSQL_PREFIX.length())) {
+ return url;
+ }
+ int fragment = jdbcUrl.indexOf('#');
+ String modernUrl = fragment < 0 ? jdbcUrl : jdbcUrl.substring(0,
fragment).trim();
+ int queryStart = modernUrl.indexOf('?');
+ String base = queryStart < 0 ? modernUrl : modernUrl.substring(0,
queryStart);
+ Matcher prefix = MYSQL_URL_PREFIX.matcher(base);
+ if (!prefix.lookingAt()
+ || (prefix.group("authority") == null && prefix.end() <
base.length()
+ && base.charAt(prefix.end()) != '/')) {
+ throw new IllegalArgumentException("Invalid MySQL jdbc_url");
+ }
+
+ Map<String, String> restrictedOptions = new HashMap<>();
+ for (String option : restrictedOptionNames) {
+ restrictedOptions.putIfAbsent(normalizeMysqlOption(option),
option);
+ }
+
+ String query = queryStart < 0 ? null : modernUrl.substring(queryStart
+ 1);
+ boolean hasCanonicalLocalInfileOption = query != null &&
checkProperties(query, "&", restrictedOptions);
+ boolean preserveQueryFragment = fragment >= 0 && query != null;
+ if (preserveQueryFragment) {
+ // Connector/J 5.1 includes the fragment in query values and reads
any following options.
+ checkLegacyMysqlQuery(jdbcUrl.substring(queryStart + 1),
restrictedOptions);
+ } else if (fragment >= 0) {
+ // Keep stripping fragments outside the query, where 5.1 could
read them as host or database text.
+ url = url.substring(0, url.indexOf('#')).trim();
+ }
+ if (prefix.group("authority") != null) {
+ checkHostProperties(base, prefix.end(), restrictedOptions);
+ }
+ if
(restrictedOptions.containsKey(normalizeMysqlOption(ALLOW_LOAD_LOCAL_INFILE))
+ && !hasCanonicalLocalInfileOption) {
+ String defaultOption = ALLOW_LOAD_LOCAL_INFILE + "=false";
+ if (preserveQueryFragment) {
+ // Insert a separate option that both drivers see without
splitting an existing value.
+ int rawQueryStart = url.indexOf('?') + 1;
+ return url.substring(0, rawQueryStart) + defaultOption + "&" +
url.substring(rawQueryStart);
+ }
+ String separator = query == null ? "?" : (query.isEmpty() ||
modernUrl.endsWith("&") ? "" : "&");
+ url += separator + defaultOption;
+ }
+ return url;
+ }
+
+ private static void checkHostProperties(String base, int start,
Map<String, String> restrictedOptions) {
+ boolean addressFormat = false;
+ int previousEnd = start;
+ for (int i = start; i < base.length(); i++) {
+ char current = base.charAt(i);
+ if (current == '/') {
+ return;
+ }
+ if (current == ')') {
+ throw new IllegalArgumentException("Invalid MySQL jdbc_url
host properties");
+ }
+ if (current != '(') {
+ continue;
+ }
+ String prefix = base.substring(previousEnd, i).trim();
+ if (!prefix.isEmpty()) {
+ addressFormat =
prefix.toLowerCase(Locale.ROOT).endsWith("address=");
+ }
+ int groupEnd = findHostPropertyEnd(base, i + 1, addressFormat);
+ String properties = base.substring(i + 1, groupEnd);
+ // address=(key=value)(key=value) has one property per group.
+ // A (key=value,key=value) host has a comma-separated list in one
group.
+ if (addressFormat) {
+ checkProperty(properties, restrictedOptions, true);
+ } else {
+ checkProperties(properties, ",", restrictedOptions);
+ }
+ previousEnd = groupEnd + 1;
+ i = groupEnd;
+ }
+ }
+
+ private static int findHostPropertyEnd(String authority, int start,
boolean addressFormat) {
+ int rawGroupEnd = authority.indexOf(')', start);
+ for (int i = start; i <= rawGroupEnd; i++) {
+ char current = authority.charAt(i);
+ if (current == ')') {
+ return i;
+ }
+ if (current == '(' || current == '/') {
+ break;
+ }
+ // Connector/J 5.1 allows quoted delimiters in legacy properties.
+ // Connector/J 8.4 ends the group at the first raw ')', so a
quoted span cannot cross it.
+ if (addressFormat && (current == '\'' || current == '"')) {
+ i = authority.indexOf(current, i + 1);
+ if (i < 0 || i > rawGroupEnd) {
+ break;
+ }
+ }
+ }
+ throw new IllegalArgumentException("Invalid MySQL jdbc_url host
properties");
+ }
+
+ private static boolean checkProperties(String properties, String separator,
+ Map<String, String> restrictedOptions) {
+ boolean hasCanonicalLocalInfileOption = false;
+ for (String property : properties.split(separator)) {
+ checkProperty(property, restrictedOptions, false);
+ // Older Connector/J versions require the exact key spelling in
the query string.
+ hasCanonicalLocalInfileOption |=
property.startsWith(ALLOW_LOAD_LOCAL_INFILE + "=");
+ }
+ return hasCanonicalLocalInfileOption;
+ }
+
+ private static void checkProperty(String property, Map<String, String>
restrictedOptions, boolean addressFormat) {
+ int equals = property.indexOf('=');
+ String key = normalizeMysqlOption(decode(equals < 0 ? property :
property.substring(0, equals)));
+ String value = equals < 0 ? "" : property.substring(equals + 1);
+ // The modern driver preserves quotes in directory values, so check
that value without unquoting.
+ if (addressFormat &&
!ALLOW_LOAD_LOCAL_INFILE_IN_PATH.equalsIgnoreCase(key)) {
+ value = unquoteLegacyHostValue(value.trim());
+ }
+ checkRestrictedMysqlOption(key, value, restrictedOptions);
+ }
+
+ private static void checkLegacyMysqlQuery(String query, Map<String,
String> restrictedOptions) {
+ for (String property : query.split("&")) {
+ int equals = property.indexOf('=');
+ // Connector/J 5.1 keeps raw keys and reads only pairs with a
nonempty key and value.
+ if (equals > 0 && equals + 1 < property.length()) {
+ String key = normalizeMysqlOption(property.substring(0,
equals));
+ checkRestrictedMysqlOption(key, property.substring(equals +
1), restrictedOptions);
+ }
+ }
+ }
+
+ private static void checkRestrictedMysqlOption(String key, String value,
Map<String, String> restrictedOptions) {
+ String option = key.isEmpty() ? null : restrictedOptions.get(key);
+ if (option != null && !isAllowedValue(key, value)) {
+ throw new IllegalArgumentException("MySQL jdbc_url disallows " +
option);
+ }
+ }
+
+ private static String unquoteLegacyHostValue(String value) {
+ if (value.length() >= 2) {
+ char quote = value.charAt(0);
+ if ((quote == '\'' || quote == '"') && value.charAt(value.length()
- 1) == quote) {
+ return value.substring(1, value.length() - 1);
+ }
+ }
+ return value;
+ }
+
+ private static String normalizeMysqlOption(String key) {
+ String normalizedKey = key.trim().toLowerCase(Locale.ROOT);
+ return MYSQL_OPTION_ALIASES.getOrDefault(normalizedKey, normalizedKey);
+ }
+
+ private static boolean isAllowedValue(String option, String rawValue) {
+ if (option.equalsIgnoreCase(ALLOW_LOAD_LOCAL_INFILE_IN_PATH)) {
+ return decode(rawValue).isEmpty();
+ }
+ if (option.equalsIgnoreCase(ALLOW_LOAD_LOCAL_INFILE) ||
option.equalsIgnoreCase(ALLOW_URL_IN_LOCAL_INFILE)) {
+ String value = decode(rawValue);
+ return value.equalsIgnoreCase("false") ||
value.equalsIgnoreCase("no");
+ }
+ return false;
+ }
+
+ private static String decode(String component) {
+ try {
+ return URLDecoder.decode(component.trim(),
StandardCharsets.UTF_8.name());
+ } catch (UnsupportedEncodingException e) {
+ throw new AssertionError(e);
+ } catch (IllegalArgumentException e) {
+ throw new IllegalArgumentException("Invalid percent encoding in
MySQL jdbc_url");
+ }
+ }
}
diff --git
a/fe/fe-foundation/src/test/java/org/apache/doris/foundation/security/JdbcDriverUrlSecurityTest.java
b/fe/fe-foundation/src/test/java/org/apache/doris/foundation/security/JdbcDriverUrlSecurityTest.java
index e3f58466dcf..42b56347508 100644
---
a/fe/fe-foundation/src/test/java/org/apache/doris/foundation/security/JdbcDriverUrlSecurityTest.java
+++
b/fe/fe-foundation/src/test/java/org/apache/doris/foundation/security/JdbcDriverUrlSecurityTest.java
@@ -19,6 +19,8 @@ package org.apache.doris.foundation.security;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
/**
* Tests for the mandatory, non-configurable driver_url security rule in
@@ -28,6 +30,68 @@ import org.junit.jupiter.api.Test;
*/
public class JdbcDriverUrlSecurityTest {
+ @Test
+ public void testPreservesQuotedLegacyHostPath() {
+ String[] restrictions = {"allowLoadLocalInfile"};
+ for (String quote : new String[] {"'", "\""}) {
+ String url =
"jdbc:mysql://address=(host=db.example)(trustCertificateKeyStoreUrl=" + quote
+ + "file:/etc/certs/example store.jks" + quote + ")/app";
+ Assertions.assertEquals(url + "?allowLoadLocalInfile=false",
+ JdbcDriverUrlSecurity.prepareMySqlJdbcUrl(url,
restrictions));
+ }
+ }
+
+ @ParameterizedTest
+ @ValueSource(chars = {'\'', '"'})
+ public void testRejectsRawClosingParenthesisInQuotedAddressValue(char
quote) {
+ String url =
"jdbc:mysql://address=(host=db.invalid)(connectionAttributes=" + quote
+ + "label:sample)value" + quote + ")/app";
+ IllegalArgumentException error =
Assertions.assertThrows(IllegalArgumentException.class,
+ () -> JdbcDriverUrlSecurity.prepareMySqlJdbcUrl(url, new
String[0]));
+ Assertions.assertEquals("Invalid MySQL jdbc_url host properties",
error.getMessage());
+ }
+
+ @ParameterizedTest
+ @ValueSource(chars = {'\'', '"'})
+ public void
testPreservesEncodedClosingParenthesisInQuotedAddressValue(char quote) {
+ String url =
"jdbc:mysql://address=(host=db.invalid)(connectionAttributes=" + quote
+ + "label:sample%29value" + quote + ")/app";
+ Assertions.assertEquals(url,
JdbcDriverUrlSecurity.prepareMySqlJdbcUrl(url, new String[0]));
+ }
+
+ @Test
+ public void testPreservesEncodedModernHostPath() {
+ String url =
"jdbc:mysql://(host=db.example,trustCertificateKeyStoreUrl=file:%2Fetc%2Fexample.jks)/app";
+ Assertions.assertEquals(url + "?allowLoadLocalInfile=false",
+ JdbcDriverUrlSecurity.prepareMySqlJdbcUrl(url, new String[]
{"allowLoadLocalInfile"}));
+ }
+
+ @Test
+ public void testPreservesLiteralHashAndPreparesSharedMysqlQueryDefault() {
+ String base = "jdbc:mysql://db.example/app?";
+ String options =
"trustCertificateKeyStorePassword=example#value&connectTimeout=5000";
+ String[] restrictions = {"allowLoadLocalInfile"};
+ String expected = base + "allowLoadLocalInfile=false&" + options;
+ Assertions.assertEquals(expected,
JdbcDriverUrlSecurity.prepareMySqlJdbcUrl(base + options, restrictions));
+ Assertions.assertEquals(expected,
JdbcDriverUrlSecurity.prepareMySqlJdbcUrl(expected, restrictions));
+ Assertions.assertEquals(base + options,
+ JdbcDriverUrlSecurity.prepareMySqlJdbcUrl(base + options, new
String[0]));
+ }
+
+ @Test
+ public void testValidatesBothMysqlQueryInterpretations() {
+ String base = "jdbc:mysql://db.example/app?";
+ String[] restrictions = {"connectTimeout"};
+ for (String options : new String[] {
+
"trustCertificateKeyStorePassword=example#value&connectTimeout=5000",
+ "connectTimeout#catalog-note"
+ }) {
+ IllegalArgumentException error =
Assertions.assertThrows(IllegalArgumentException.class,
+ () -> JdbcDriverUrlSecurity.prepareMySqlJdbcUrl(base +
options, restrictions));
+ Assertions.assertEquals("MySQL jdbc_url disallows connectTimeout",
error.getMessage());
+ }
+ }
+
// ---- rejected ----
@Test
diff --git
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
index 85fa5a3ef4e..ae6fb7943a1 100644
---
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
+++
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
@@ -1317,6 +1317,19 @@ class Config {
}
}
+ String getCatalogJdbcUrl() {
+ // The regression client needs LOCAL INFILE for LOAD DATA. Catalog
fixtures do not.
+ int queryStart = jdbcUrl.indexOf('?') + 1
+ if (queryStart == 0) {
+ return jdbcUrl
+ }
+ int fragmentStart = jdbcUrl.indexOf('#', queryStart)
+ int queryEnd = fragmentStart < 0 ? jdbcUrl.length() : fragmentStart
+ String options = jdbcUrl.substring(queryStart, queryEnd)
+ return jdbcUrl.substring(0, queryStart) +
+ options.replaceAll(/(?i)((?:^|&)allowLoadLocalInfile=)[^&]*/,
'$1false') + jdbcUrl.substring(queryEnd)
+ }
+
public static String buildUrlWithDbImpl(String jdbcUrl, String dbName) {
if (!dbName?.trim()) {
return jdbcUrl
diff --git
a/regression-test/suites/ddl_p0/create_view_nereids/create_view_nereids_fix_null.groovy
b/regression-test/suites/ddl_p0/create_view_nereids/create_view_nereids_fix_null.groovy
index 99f87d03403..576891fb9a5 100644
---
a/regression-test/suites/ddl_p0/create_view_nereids/create_view_nereids_fix_null.groovy
+++
b/regression-test/suites/ddl_p0/create_view_nereids/create_view_nereids_fix_null.groovy
@@ -33,7 +33,7 @@ suite("create_view_nereids_fix_null") {
logger.info("bucket: " + bucket)
String driver_url =
"https://${bucket}.${s3_endpoint}/regression/jdbc_driver/mysql-connector-j-8.4.0.jar"
String dbname = context.config.getDbNameByFile(context.file)
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = context.config.jdbcUser
logger.info("jdbcUser: " + jdbcUser)
String jdbcPassword = context.config.jdbcPassword
diff --git
a/regression-test/suites/external_table_p0/jdbc/test_doris_jdbc_catalog.groovy
b/regression-test/suites/external_table_p0/jdbc/test_doris_jdbc_catalog.groovy
index 743cc79d5de..a09d9d26d77 100644
---
a/regression-test/suites/external_table_p0/jdbc/test_doris_jdbc_catalog.groovy
+++
b/regression-test/suites/external_table_p0/jdbc/test_doris_jdbc_catalog.groovy
@@ -18,7 +18,7 @@
suite("test_doris_jdbc_catalog",
"p0,external,doris,external_docker,external_docker_doris") {
qt_sql """select current_catalog()"""
- String jdbcUrl = context.config.jdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
+ String jdbcUrl = context.config.catalogJdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/jdbc/test_doris_jdbc_catalog_query_bitmap.groovy
b/regression-test/suites/external_table_p0/jdbc/test_doris_jdbc_catalog_query_bitmap.groovy
index 194b42ad9f2..841965902a6 100644
---
a/regression-test/suites/external_table_p0/jdbc/test_doris_jdbc_catalog_query_bitmap.groovy
+++
b/regression-test/suites/external_table_p0/jdbc/test_doris_jdbc_catalog_query_bitmap.groovy
@@ -18,7 +18,7 @@
suite("test_doris_jdbc_catalog_query_bitmap",
"p0,external,doris,external_docker,external_docker_doris") {
qt_sql """select current_catalog()"""
- String jdbcUrl = context.config.jdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
+ String jdbcUrl = context.config.catalogJdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/jdbc/test_jdbc_call.groovy
b/regression-test/suites/external_table_p0/jdbc/test_jdbc_call.groovy
index 146e843b38e..bd56bf0e53d 100644
--- a/regression-test/suites/external_table_p0/jdbc/test_jdbc_call.groovy
+++ b/regression-test/suites/external_table_p0/jdbc/test_jdbc_call.groovy
@@ -16,7 +16,7 @@
// under the License.
suite("test_jdbc_call",
"p0,external,doris,external_docker,external_docker_doris") {
- String jdbcUrl = context.config.jdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
+ String jdbcUrl = context.config.catalogJdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/jdbc/test_jni_complex_type.groovy
b/regression-test/suites/external_table_p0/jdbc/test_jni_complex_type.groovy
index 8d56a1702f6..a0e82d3179a 100644
--- a/regression-test/suites/external_table_p0/jdbc/test_jni_complex_type.groovy
+++ b/regression-test/suites/external_table_p0/jdbc/test_jni_complex_type.groovy
@@ -18,7 +18,7 @@
suite("test_jni_complex_type",
"p0,external,doris,external_docker,external_docker_doris") {
qt_sql """select current_catalog()"""
- String jdbcUrl = context.config.jdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
+ String jdbcUrl = context.config.catalogJdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog_table_comment.groovy
b/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog_table_comment.groovy
index 7a33d718d8b..72a6b936f95 100644
---
a/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog_table_comment.groovy
+++
b/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog_table_comment.groovy
@@ -61,7 +61,7 @@ suite("test_jdbc_mysql_catalog_table_comment") {
}
// doris catalog
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = "test_doris_catalog"
String jdbcPassword = "C123_567p"
driver_url =
"https://${bucket}.${s3_endpoint}/regression/jdbc_driver/mysql-connector-j-8.3.0.jar"
diff --git
a/regression-test/suites/external_table_p0/jdbc/test_non_nullable_jdbc_mtmv.groovy
b/regression-test/suites/external_table_p0/jdbc/test_non_nullable_jdbc_mtmv.groovy
index dd5787597a3..32c4e347037 100644
---
a/regression-test/suites/external_table_p0/jdbc/test_non_nullable_jdbc_mtmv.groovy
+++
b/regression-test/suites/external_table_p0/jdbc/test_non_nullable_jdbc_mtmv.groovy
@@ -27,7 +27,7 @@ suite("test_non_nullable_jdbc_mtmv", "p0,external") {
sql "DROP CATALOG IF EXISTS non_nullable_mv_jdbc"
sql """CREATE CATALOG non_nullable_mv_jdbc PROPERTIES (
"type" = "jdbc", "user" = "${context.config.jdbcUser}", "password" =
"${context.config.jdbcPassword}",
- "jdbc_url" = "${context.config.jdbcUrl}", "driver_url" = "${driver}",
+ "jdbc_url" = "${context.config.catalogJdbcUrl}", "driver_url" =
"${driver}",
"driver_class" = "com.mysql.cj.jdbc.Driver"
)"""
checkNonNullableMvRewrite("non_nullable_mv_jdbc.${db}.non_nullable_jdbc_base",
diff --git
a/regression-test/suites/external_table_p0/jdbc/test_query_tvf_cross_catalog.groovy
b/regression-test/suites/external_table_p0/jdbc/test_query_tvf_cross_catalog.groovy
index eee44c20c50..bdae74c21f2 100644
---
a/regression-test/suites/external_table_p0/jdbc/test_query_tvf_cross_catalog.groovy
+++
b/regression-test/suites/external_table_p0/jdbc/test_query_tvf_cross_catalog.groovy
@@ -16,7 +16,7 @@
// under the License.
suite("test_query_tvf_cross_catalog",
"p0,external,mysql,external_docker,external_docker_mysql") {
- String jdbcUrl = context.config.jdbcUrl +
"&jdbcCompliantTruncation=false&sessionVariables=return_object_data_as_binary=true"
+ String jdbcUrl = context.config.catalogJdbcUrl +
"&jdbcCompliantTruncation=false&sessionVariables=return_object_data_as_binary=true"
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
String enabled = context.config.otherConfigs.get("enableJdbcTest")
diff --git
a/regression-test/suites/external_table_p0/jdbc/type_test/select/test_doris_all_types_select.groovy
b/regression-test/suites/external_table_p0/jdbc/type_test/select/test_doris_all_types_select.groovy
index 06aa7184f4a..b82b874c83a 100644
---
a/regression-test/suites/external_table_p0/jdbc/type_test/select/test_doris_all_types_select.groovy
+++
b/regression-test/suites/external_table_p0/jdbc/type_test/select/test_doris_all_types_select.groovy
@@ -16,7 +16,7 @@
// under the License.
suite("test_doris_all_types_select",
"p0,external,doris,external_docker,external_docker_doris") {
- String jdbcUrl = context.config.jdbcUrl +
"&jdbcCompliantTruncation=false&sessionVariables=return_object_data_as_binary=true"
+ String jdbcUrl = context.config.catalogJdbcUrl +
"&jdbcCompliantTruncation=false&sessionVariables=return_object_data_as_binary=true"
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/lower_case/test_conflict_name.groovy
b/regression-test/suites/external_table_p0/lower_case/test_conflict_name.groovy
index f5760e5ab66..e5b7bc17c7a 100644
---
a/regression-test/suites/external_table_p0/lower_case/test_conflict_name.groovy
+++
b/regression-test/suites/external_table_p0/lower_case/test_conflict_name.groovy
@@ -17,7 +17,7 @@
suite("test_conflict_name",
"p0,external,doris,meta_names_mapping,external_docker") {
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = "test_conflict_name_user"
String jdbcPassword = "C123_567p"
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_include.groovy
b/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_include.groovy
index cf4dcb37681..a5d227e6985 100644
---
a/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_include.groovy
+++
b/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_include.groovy
@@ -17,7 +17,7 @@
suite("test_lower_case_meta_include",
"p0,external,doris,external_docker,external_docker_doris") {
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = "test_lower_include_user"
String jdbcPassword = "C123_567p"
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_show_and_select.groovy
b/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_show_and_select.groovy
index 0268f668fb3..8781005dc74 100644
---
a/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_show_and_select.groovy
+++
b/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_show_and_select.groovy
@@ -21,7 +21,7 @@ import org.awaitility.Awaitility
suite("test_lower_case_meta_show_and_select",
"p0,external,doris,external_docker,external_docker_doris") {
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = "test_lower_without_conf_user"
String jdbcPassword = "C123_567p"
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_with_lower_table_conf_grant.groovy
b/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_with_lower_table_conf_grant.groovy
index 6ed619b2b42..c06ef93955d 100644
---
a/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_with_lower_table_conf_grant.groovy
+++
b/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_with_lower_table_conf_grant.groovy
@@ -17,7 +17,7 @@
suite("test_lower_case_meta_with_lower_table_conf_auth",
"p0,external,doris,external_docker,external_docker_doris") {
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_with_lower_table_conf_show_and_select.groovy
b/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_with_lower_table_conf_show_and_select.groovy
index 6410d6fb54c..ed4c142cef3 100644
---
a/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_with_lower_table_conf_show_and_select.groovy
+++
b/regression-test/suites/external_table_p0/lower_case/test_lower_case_meta_with_lower_table_conf_show_and_select.groovy
@@ -21,7 +21,7 @@ import org.awaitility.Awaitility
suite("test_lower_case_meta_with_lower_table_conf_show_and_select",
"p0,external,doris,external_docker,external_docker_doris") {
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = "test_lower_with_conf"
String jdbcPassword = "C123_567p"
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/lower_case/test_lower_case_mtmv.groovy
b/regression-test/suites/external_table_p0/lower_case/test_lower_case_mtmv.groovy
index 5b57d651c22..c2a9adecb46 100644
---
a/regression-test/suites/external_table_p0/lower_case/test_lower_case_mtmv.groovy
+++
b/regression-test/suites/external_table_p0/lower_case/test_lower_case_mtmv.groovy
@@ -17,7 +17,7 @@
suite("test_lower_case_mtmv",
"p0,external,doris,external_docker,external_docker_doris") {
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = "test_lower_case_mtmv_user"
String jdbcPassword = "C123_567p"
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/lower_case/test_meta_cache_select_without_refresh.groovy
b/regression-test/suites/external_table_p0/lower_case/test_meta_cache_select_without_refresh.groovy
index c76b7ed7913..d043fc845e1 100644
---
a/regression-test/suites/external_table_p0/lower_case/test_meta_cache_select_without_refresh.groovy
+++
b/regression-test/suites/external_table_p0/lower_case/test_meta_cache_select_without_refresh.groovy
@@ -17,7 +17,7 @@
suite("test_meta_cache_select_without_refresh",
"p0,external,doris,external_docker,external_docker_doris") {
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = "test_meta_cache_select_without_refresh_user"
String jdbcPassword = "C123_567p"
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/lower_case/test_meta_names_mapping.groovy
b/regression-test/suites/external_table_p0/lower_case/test_meta_names_mapping.groovy
index 399969ef99a..ad4b47bc263 100644
---
a/regression-test/suites/external_table_p0/lower_case/test_meta_names_mapping.groovy
+++
b/regression-test/suites/external_table_p0/lower_case/test_meta_names_mapping.groovy
@@ -17,7 +17,7 @@
suite("test_meta_names_mapping",
"p0,external,doris,meta_names_mapping,external_docker") {
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = "test_meta_names_mapping_user"
String jdbcPassword = "C123_567p"
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/lower_case/test_timing_refresh_catalog.groovy
b/regression-test/suites/external_table_p0/lower_case/test_timing_refresh_catalog.groovy
index 4b67d5a73b7..37bd7290150 100644
---
a/regression-test/suites/external_table_p0/lower_case/test_timing_refresh_catalog.groovy
+++
b/regression-test/suites/external_table_p0/lower_case/test_timing_refresh_catalog.groovy
@@ -21,7 +21,7 @@ import org.awaitility.Awaitility
suite("test_timing_refresh_catalog",
"p0,external,doris,external_docker,external_docker_doris") {
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = "test_timing_refresh_catalog_user"
String jdbcPassword = "C123_567p"
String s3_endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/external_table_p0/lower_case/upgrade/load.groovy
b/regression-test/suites/external_table_p0/lower_case/upgrade/load.groovy
index 66c1a96155e..08f42d25c9a 100644
--- a/regression-test/suites/external_table_p0/lower_case/upgrade/load.groovy
+++ b/regression-test/suites/external_table_p0/lower_case/upgrade/load.groovy
@@ -21,7 +21,7 @@ import org.awaitility.Awaitility
suite("test_upgrade_lower_case_catalog_prepare",
"p0,external,doris,external_docker,external_docker_doris,restart_fe") {
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = "test_upgrade_lower_case_catalog_user"
String jdbcPassword = "C123_567p"
String s3_endpoint = getS3Endpoint()
diff --git a/regression-test/suites/nereids_syntax_p0/alias_conflict.groovy
b/regression-test/suites/nereids_syntax_p0/alias_conflict.groovy
index 87946d7a357..65c966302ba 100644
--- a/regression-test/suites/nereids_syntax_p0/alias_conflict.groovy
+++ b/regression-test/suites/nereids_syntax_p0/alias_conflict.groovy
@@ -165,7 +165,7 @@ suite("alias_conflict") {
'type'='jdbc',
'user'='${context.config.jdbcUser}',
'password'='${context.config.jdbcPassword}',
- 'jdbc_url' = '${context.config.jdbcUrl}',
+ 'jdbc_url' = '${context.config.catalogJdbcUrl}',
'driver_url' = "${driver_url}",
'driver_class' = 'com.mysql.cj.jdbc.Driver'
);
diff --git
a/regression-test/suites/plugin_p1/test_cloud_plugin_auto_download.groovy
b/regression-test/suites/plugin_p1/test_cloud_plugin_auto_download.groovy
index 2b697db07ba..dbab907d2d1 100644
--- a/regression-test/suites/plugin_p1/test_cloud_plugin_auto_download.groovy
+++ b/regression-test/suites/plugin_p1/test_cloud_plugin_auto_download.groovy
@@ -23,7 +23,7 @@ suite("test_cloud_plugin_auto_download", "p1,external") {
return
}
- String jdbcUrl = context.config.jdbcUrl
+ String jdbcUrl = context.config.catalogJdbcUrl
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
diff --git
a/regression-test/suites/ranger_p2/test_ranger_access_resource_catalog.groovy
b/regression-test/suites/ranger_p2/test_ranger_access_resource_catalog.groovy
index aed26f0c6d8..97814a26d1c 100644
---
a/regression-test/suites/ranger_p2/test_ranger_access_resource_catalog.groovy
+++
b/regression-test/suites/ranger_p2/test_ranger_access_resource_catalog.groovy
@@ -95,7 +95,7 @@ suite("test_ranger_access_resource_catalog",
"p2,ranger,external") {
String rangerServiceName =
context.config.otherConfigs.get("rangerServiceName")
String externalEnvIp = context.config.otherConfigs.get("externalEnvIp")
String HmsPort = context.config.otherConfigs.get("hive3HmsPort")
- String jdbcUrl = context.config.jdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
+ String jdbcUrl = context.config.catalogJdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
String s3Endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/ranger_p2/test_ranger_access_resource_global.groovy
b/regression-test/suites/ranger_p2/test_ranger_access_resource_global.groovy
index fa8dd95b47c..eb112303922 100644
--- a/regression-test/suites/ranger_p2/test_ranger_access_resource_global.groovy
+++ b/regression-test/suites/ranger_p2/test_ranger_access_resource_global.groovy
@@ -95,7 +95,7 @@ suite("test_ranger_access_resource_global",
"p2,ranger,external") {
String rangerServiceName =
context.config.otherConfigs.get("rangerServiceName")
String externalEnvIp = context.config.otherConfigs.get("externalEnvIp")
String HmsPort = context.config.otherConfigs.get("hive3HmsPort")
- String jdbcUrl = context.config.jdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
+ String jdbcUrl = context.config.catalogJdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
String s3Endpoint = getS3Endpoint()
diff --git
a/regression-test/suites/ranger_p2/test_ranger_access_role_resource_catalog.groovy
b/regression-test/suites/ranger_p2/test_ranger_access_role_resource_catalog.groovy
index aa6f311d0b2..4af5ff7c993 100644
---
a/regression-test/suites/ranger_p2/test_ranger_access_role_resource_catalog.groovy
+++
b/regression-test/suites/ranger_p2/test_ranger_access_role_resource_catalog.groovy
@@ -96,7 +96,7 @@ suite("test_ranger_access_role_resource_catalog",
"p2,ranger,external") {
String rangerServiceName =
context.config.otherConfigs.get("rangerServiceName")
String externalEnvIp = context.config.otherConfigs.get("externalEnvIp")
String HmsPort = context.config.otherConfigs.get("hive3HmsPort")
- String jdbcUrl = context.config.jdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
+ String jdbcUrl = context.config.catalogJdbcUrl +
"&sessionVariables=return_object_data_as_binary=true"
String jdbcUser = context.config.jdbcUser
String jdbcPassword = context.config.jdbcPassword
String s3Endpoint = getS3Endpoint()
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]