Skip to content

Commit 86c893c

Browse files
authored
[INLONG-11731][Manager]Fix the problem of Sensitive parameters are bypassed during JDBC verification processing (#11732)
1 parent b37f944 commit 86c893c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

inlong-manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/util/MySQLSensitiveUrlUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ public static String filterSensitive(String url) {
119119

120120
public static String containSensitiveKey(String url) {
121121
for (String key : SENSITIVE_REPLACE_PARAM_MAP.keySet()) {
122-
if (url.contains(key + InlongConstants.EQUAL + "true")
123-
|| url.contains(key + InlongConstants.EQUAL + "yes")) {
122+
if (StringUtils.containsIgnoreCase(url, key + InlongConstants.EQUAL + "true")
123+
|| StringUtils.containsIgnoreCase(url, key + InlongConstants.EQUAL + "yes")) {
124124
return key;
125125
}
126126
}

inlong-manager/manager-pojo/src/test/java/org/apache/inlong/manager/pojo/sink/mysql/MySQLSinkDTOTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ public class MySQLSinkDTOTest {
3131
public void testFilterSensitive() throws Exception {
3232
// the sensitive params no use url code
3333
String originUrl = MySQLSinkDTO.filterSensitive(
34+
"jdbc:mysql://127.0.0.1,(allowLoadLocalInfile=yeſ,allowUrlInLocalInfile=yeſ,allowLoadLocalInfileInPath=.,maxAllowedPacket=655360),:3307/test");
35+
Assertions.assertEquals(
36+
"jdbc:mysql://127.0.0.1,(,,allowLoadLocalInfileInPath=.,maxAllowedPacket=655360),:3307/test",
37+
originUrl);
38+
39+
originUrl = MySQLSinkDTO.filterSensitive(
3440
"jdbc:mysql://127.0.0.1:3306?autoDeserialize=TRue&allowLoadLocalInfile = TRue&allowUrlInLocalInfile=TRue&allowLoadLocalInfileInPath=/&autoReconnect=true");
3541
Assertions.assertEquals(
3642
"jdbc:mysql://127.0.0.1:3306?autoReconnect=true&autoDeserialize=false&allowUrlInLocalInfile=false&allowLoadLocalInfile=false",

0 commit comments

Comments
 (0)