aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorAntoine Vigneau <antoine.vigneau@sonarsource.com>2023-06-07 15:44:35 +0200
committerAntoine Vigneau <antoine.vigneau@sonarsource.com>2023-06-08 13:59:50 +0200
commit528022bc8aa28d2fcef2e1e54370d874ff9965ab (patch)
tree9c023c5061a36d25d48b632a69c8e243b3c52d1d /src/test
parent6529bb38fb5df5918151d4e9b0c08c5841ae7439 (diff)
downloadsonar-scanner-cli-528022bc8aa28d2fcef2e1e54370d874ff9965ab.tar.gz
sonar-scanner-cli-528022bc8aa28d2fcef2e1e54370d874ff9965ab.zip
SQSCANNER-115 Fix SSF-392
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java b/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java
index c6c0585..3e11c44 100644
--- a/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java
+++ b/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java
@@ -89,4 +89,16 @@ public class SystemInfoTest {
verify(logs).info("SONAR_SCANNER_OPTS=arg");
verifyNoMoreInteractions(logs);
}
+
+ @Test
+ public void should_not_print_sensitive_data() {
+ mockOs();
+ mockJava();
+ when(mockSystem.getenv("SONAR_SCANNER_OPTS"))
+ .thenReturn("-Dsonar.login=login -Dsonar.whatever=whatever -Dsonar.password=password -Dsonar.whatever2=whatever2 -Dsonar.token=token");
+
+ SystemInfo.print(logs);
+
+ verify(logs).info("SONAR_SCANNER_OPTS=-Dsonar.login=* -Dsonar.whatever=whatever -Dsonar.password=* -Dsonar.whatever2=whatever2 -Dsonar.token=*");
+ }
}