aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/main/java/org/sonar/batch
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2016-05-09 10:45:12 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2016-05-10 10:11:04 +0200
commit2060793a67a2e145332bcd780b166a76b9bb0672 (patch)
tree8bbc9fe49b4b625c5663c579c2b04e7d6895ad53 /sonar-scanner-engine/src/main/java/org/sonar/batch
parent9391fdfd8207d9fb3adba94024528dd3890ceee3 (diff)
downloadsonarqube-2060793a67a2e145332bcd780b166a76b9bb0672.tar.gz
sonarqube-2060793a67a2e145332bcd780b166a76b9bb0672.zip
SONAR-7598 Hide sensitive properties in scanner report for global properties
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/batch')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/batch/report/AnalysisContextReportPublisher.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/report/AnalysisContextReportPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/report/AnalysisContextReportPublisher.java
index d294f55db65..38706664ff8 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/batch/report/AnalysisContextReportPublisher.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/report/AnalysisContextReportPublisher.java
@@ -115,8 +115,8 @@ public class AnalysisContextReportPublisher {
private void writeGlobalSettings(BufferedWriter fileWriter) throws IOException {
fileWriter.append("Global properties:\n");
Map<String, String> props = globalRepositories.globalSettings();
- for (String env : new TreeSet<>(props.keySet())) {
- fileWriter.append(String.format(KEY_VALUE_FORMAT, env, props.get(env))).append('\n');
+ for (String prop : new TreeSet<>(props.keySet())) {
+ dumpPropIfNotSensitive(fileWriter, prop, props.get(prop));
}
}
@@ -133,13 +133,17 @@ public class AnalysisContextReportPublisher {
if (isSystemProp(prop) || isEnvVariable(prop) || !isSqProp(prop)) {
continue;
}
- fileWriter.append(String.format(KEY_VALUE_FORMAT, prop, sensitive(prop) ? "******" : moduleSpecificProps.get(prop))).append('\n');
+ dumpPropIfNotSensitive(fileWriter, prop, moduleSpecificProps.get(prop));
}
} catch (IOException e) {
throw new IllegalStateException("Unable to write analysis log", e);
}
}
+ private static void dumpPropIfNotSensitive(BufferedWriter fileWriter, String prop, String value) throws IOException {
+ fileWriter.append(String.format(KEY_VALUE_FORMAT, prop, sensitive(prop) ? "******" : value)).append('\n');
+ }
+
/**
* Only keep props that are not in parent
*/