Repository: incubator-brooklyn Updated Branches: refs/heads/master 9fa0e3b34 -> 09b4e2361
Sanitize log messages Reduce the risk of logging secrets, by using Sanitizer.sanitize Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/6e37f7bc Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/6e37f7bc Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/6e37f7bc Branch: refs/heads/master Commit: 6e37f7bc190c1a3818b963a16d0317b5b9a65491 Parents: c89d136 Author: Aled Sage <[email protected]> Authored: Mon Nov 23 13:59:06 2015 +0000 Committer: Aled Sage <[email protected]> Committed: Tue Nov 24 15:09:48 2015 +0000 ---------------------------------------------------------------------- .../org/apache/brooklyn/location/ssh/SshMachineLocation.java | 5 +++-- .../org/apache/brooklyn/location/jclouds/JcloudsLocation.java | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6e37f7bc/core/src/main/java/org/apache/brooklyn/location/ssh/SshMachineLocation.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/brooklyn/location/ssh/SshMachineLocation.java b/core/src/main/java/org/apache/brooklyn/location/ssh/SshMachineLocation.java index 2d56801..762a0c4 100644 --- a/core/src/main/java/org/apache/brooklyn/location/ssh/SshMachineLocation.java +++ b/core/src/main/java/org/apache/brooklyn/location/ssh/SshMachineLocation.java @@ -58,6 +58,7 @@ import org.apache.brooklyn.core.config.BasicConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.config.ConfigUtils; import org.apache.brooklyn.core.config.MapConfigKey; +import org.apache.brooklyn.core.config.Sanitizer; import org.apache.brooklyn.core.entity.BrooklynConfigKeys; import org.apache.brooklyn.core.location.AbstractLocation; import org.apache.brooklyn.core.location.BasicHardwareDetails; @@ -358,7 +359,7 @@ public class SshMachineLocation extends AbstractLocation implements MachineLocat public Pool<SshTool> load(Map<String, ?> properties) { if (LOG.isDebugEnabled()) { LOG.debug("{} building ssh pool for {} with properties: {}", - new Object[] {this, getSshHostAndPort(), properties}); + new Object[] {this, getSshHostAndPort(), Sanitizer.sanitize(properties)}); } return buildPool(properties); } @@ -628,7 +629,7 @@ public class SshMachineLocation extends AbstractLocation implements MachineLocat // Explicit props trump all. args.putAll(props); - if (LOG.isTraceEnabled()) LOG.trace("creating ssh session for "+args); + if (LOG.isTraceEnabled()) LOG.trace("creating ssh session for "+Sanitizer.sanitize(args)); if (!user.equals(args.get(SshTool.PROP_USER))) { LOG.warn("User mismatch configuring ssh for "+this+": preferring user "+args.get(SshTool.PROP_USER)+" over "+user); user = args.get(SshTool.PROP_USER); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6e37f7bc/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java index 2344c71..5afc3b3 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java @@ -712,8 +712,9 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im new Object[] {template, template.getOptions(), setup.getDescription()}); if (!setup.getUnusedConfig().isEmpty()) - LOG.debug("NOTE: unused flags passed to obtain VM in "+setup.getDescription()+": "+ - setup.getUnusedConfig()); + if (LOG.isDebugEnabled()) + LOG.debug("NOTE: unused flags passed to obtain VM in "+setup.getDescription()+": " + + Sanitizer.sanitize(setup.getUnusedConfig())); nodes = computeService.createNodesInGroup(groupId, 1, template); provisionTimestamp = Duration.of(provisioningStopwatch); @@ -1097,7 +1098,7 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im @Override public MachineLocation resumeMachine(Map<?, ?> flags) { ConfigBag setup = ConfigBag.newInstanceExtending(config().getBag(), flags); - LOG.info("{} using resuming node matching properties: {}", this, setup); + LOG.info("{} using resuming node matching properties: {}", this, Sanitizer.sanitize(setup)); ComputeService computeService = getComputeService(setup); NodeMetadata node = findNodeOrThrow(setup); LOG.debug("{} resuming {}", this, node);
