diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java index c6eecb4212..3d7196bae0 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java @@ -734,7 +734,7 @@ public final class Constants { * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = - "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; + "(?<=((?i)password((\":\")|(=')))).*?(?=((\")|(')))"; /** * default worker group diff --git a/dolphinscheduler-log-server/src/test/java/org/apache/dolphinscheduler/server/log/SensitiveDataConverterTest.java b/dolphinscheduler-log-server/src/test/java/org/apache/dolphinscheduler/server/log/SensitiveDataConverterTest.java index a8733f2df0..cd573cc51a 100644 --- a/dolphinscheduler-log-server/src/test/java/org/apache/dolphinscheduler/server/log/SensitiveDataConverterTest.java +++ b/dolphinscheduler-log-server/src/test/java/org/apache/dolphinscheduler/server/log/SensitiveDataConverterTest.java @@ -47,11 +47,11 @@ public class SensitiveDataConverterTest { + "\"database\":\"carbond\"," + "\"jdbcUrl\":\"jdbc:mysql://192.168.xx.xx:3306/ods\"," + "\"user\":\"view\"," - + "\"password\":\"******\"}"; + + "\"password\":\"*****\"}"; @Test public void convert() { - Assert.assertNotEquals(maskLogMsg, passwordHandler(pwdPattern, logMsg)); + Assert.assertEquals(maskLogMsg, passwordHandler(pwdPattern, logMsg)); } /** @@ -62,8 +62,8 @@ public class SensitiveDataConverterTest { logger.info("parameter : {}", logMsg); logger.info("parameter : {}", passwordHandler(pwdPattern, logMsg)); - Assert.assertEquals(logMsg, passwordHandler(pwdPattern, logMsg)); - Assert.assertNotEquals(maskLogMsg, passwordHandler(pwdPattern, logMsg)); + Assert.assertNotEquals(logMsg, passwordHandler(pwdPattern, logMsg)); + Assert.assertEquals(maskLogMsg, passwordHandler(pwdPattern, logMsg)); }