This is an automated email from the ASF dual-hosted git repository. aloyszhang pushed a commit to branch release-1.11.0 in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/release-1.11.0 by this push: new a71e5e81c1 [INLONG-9706][Manager] Supports jdbc verification under multiple hosts, backport from pull request 9707 (#10852) a71e5e81c1 is described below commit a71e5e81c1c5a32cf920963ac926f9c8d2fc9b9f Author: Yiheng Cao <65160922+crispy-fried-chic...@users.noreply.github.com> AuthorDate: Tue Aug 27 19:51:43 2024 +0800 [INLONG-9706][Manager] Supports jdbc verification under multiple hosts, backport from pull request 9707 (#10852) --- .../inlong/manager/common/consts/InlongConstants.java | 2 ++ .../inlong/manager/pojo/util/MySQLSensitiveUrlUtils.java | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/InlongConstants.java b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/InlongConstants.java index 0f6c86056a..c3085972fd 100644 --- a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/InlongConstants.java +++ b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/consts/InlongConstants.java @@ -48,6 +48,8 @@ public class InlongConstants { public static final String EMPTY = ""; + public static final String SHARP = "#"; + public static final String SLASH = "/"; public static final String COLON = ":"; diff --git a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/util/MySQLSensitiveUrlUtils.java b/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/util/MySQLSensitiveUrlUtils.java index e155887f1e..bb10e33a09 100644 --- a/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/util/MySQLSensitiveUrlUtils.java +++ b/inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/util/MySQLSensitiveUrlUtils.java @@ -71,6 +71,13 @@ public class MySQLSensitiveUrlUtils { } resultUrl = resultUrl.replaceAll(InlongConstants.REGEX_WHITESPACE, InlongConstants.EMPTY); + for (String key : SENSITIVE_REPLACE_PARAM_MAP.keySet()) { + resultUrl = StringUtils.replaceIgnoreCase(resultUrl, key + InlongConstants.EQUAL + "true", + InlongConstants.EMPTY); + resultUrl = StringUtils.replaceIgnoreCase(resultUrl, key + InlongConstants.EQUAL + "yes", + InlongConstants.EMPTY); + } + if (resultUrl.contains(InlongConstants.QUESTION_MARK)) { StringBuilder builder = new StringBuilder(); builder.append(StringUtils.substringBefore(resultUrl, InlongConstants.QUESTION_MARK)); @@ -78,10 +85,13 @@ public class MySQLSensitiveUrlUtils { List<String> paramList = new ArrayList<>(); String queryString = StringUtils.substringAfter(resultUrl, InlongConstants.QUESTION_MARK); - if (queryString.contains("#")) { - queryString = StringUtils.substringBefore(queryString, "#"); + if (queryString.contains(InlongConstants.SHARP)) { + queryString = StringUtils.substringBefore(queryString, InlongConstants.SHARP); } for (String param : queryString.split(InlongConstants.AMPERSAND)) { + if (StringUtils.isBlank(param)) { + continue; + } String key = StringUtils.substringBefore(param, InlongConstants.EQUAL); String value = StringUtils.substringAfter(param, InlongConstants.EQUAL);