Browse Source

[Cherry-pick-3.0.1][fix-11452][Bug] [Logger Server] Incorrect password regular expression (#11993)

Co-authored-by: jackfanwan <61672564+jackfanwan@users.noreply.github.com>
3.0.1-release
caishunfeng 2 years ago committed by GitHub
parent
commit
3ea17820a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
  2. 8
      dolphinscheduler-log-server/src/test/java/org/apache/dolphinscheduler/server/log/SensitiveDataConverterTest.java

3
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java

@ -766,7 +766,8 @@ public final class Constants {
/**
* dataSource sensitive param
*/
public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))";
public static final String DATASOURCE_PASSWORD_REGEX =
"(?<=((?i)password((\":\")|(=')))).*?(?=((\")|(')))";
/**
* default worker group

8
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));
}

Loading…
Cancel
Save