v0.2.52..v0.2.53 changeset ExternalCommandRunnerImpl.java
Garret Voltz edited this page Feb 12, 2020
·
1 revision
diff --git a/hoot-services/src/main/java/hoot/services/command/ExternalCommandRunnerImpl.java b/hoot-services/src/main/java/hoot/services/command/ExternalCommandRunnerImpl.java
index c80862b..cf5135f 100644
--- a/hoot-services/src/main/java/hoot/services/command/ExternalCommandRunnerImpl.java
+++ b/hoot-services/src/main/java/hoot/services/command/ExternalCommandRunnerImpl.java
@@ -22,13 +22,12 @@
* This will properly maintain the copyright information. DigitalGlobe
* copyrights will be updated automatically.
*
- * @copyright Copyright (C) 2016, 2017, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2016, 2017, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
*/
package hoot.services.command;
import static hoot.services.HootProperties.replaceSensitiveData;
-import static hoot.services.models.db.QMaps.maps;
import java.io.File;
import java.io.IOException;
@@ -54,7 +53,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import hoot.services.HootProperties;
-import hoot.services.job.JobType;
import hoot.services.utils.DbUtils;
@@ -97,6 +95,12 @@ public class ExternalCommandRunnerImpl implements ExternalCommandRunner {
//escape single quotes
out = out.replaceAll("'", "''");
+ //strip out oauth tokens
+ out = out.replaceAll("=\\w{40}\\s+", "=<redacted> ");
+
+ //strip out osm api url
+ out = out.replaceAll("https?://\\S+?/", "<osmapi>/");
+
return out;
}
@@ -165,8 +169,8 @@ public class ExternalCommandRunnerImpl implements ExternalCommandRunner {
CommandLine cmdLine = parse(commandTemplate, expandSensitiveProperties(substitutionMap));
// Sensitive params obfuscated
- obfuscatedCommand = Arrays.stream(parse(commandTemplate, substitutionMap).toStrings())
- .collect(Collectors.joining(" "));
+ obfuscatedCommand = obfuscateConsoleLog(Arrays.stream(parse(commandTemplate, substitutionMap).toStrings())
+ .collect(Collectors.joining(" ")));
LocalDateTime start = LocalDateTime.now();
Exception exception = null;
@@ -329,6 +333,9 @@ public class ExternalCommandRunnerImpl implements ExternalCommandRunner {
public void terminate() {
if (!this.watchDog.killedProcess()) {
this.watchDog.destroyProcess();
+ logger.info("destroy processd");
+ } else {
+ logger.info("process already killed");
}
}
}