Skip to content
Permalink
Browse files

[FIXED JENKINS-4428] MavenProbeAction exposes password parameters

Signed-off-by: Anders Hammar <anders@hammar.net>
  • Loading branch information
andham committed Aug 14, 2015
1 parent a598af0 commit 3e970728b46198aa898e507963cc6da27d5ce8cf
@@ -848,7 +848,7 @@ protected Result doRun(final BuildListener listener) throws Exception {

MavenProbeAction mpa=null;
try {
mpa = new MavenProbeAction(project,process.channel);
mpa = new MavenProbeAction(project, process.channel, MavenModuleSetBuild.this);
addAction(mpa);
r = process.call(builder);
for (ProxyImpl2 proxy : proxies.values()) {
@@ -33,9 +33,13 @@
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import com.google.common.collect.Maps;

import javax.servlet.ServletException;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

/**
* UI for probing Maven process.
@@ -49,11 +53,13 @@
*/
public final class MavenProbeAction implements Action {
private final transient Channel channel;
private final transient AbstractMavenBuild<?,?> build;

public final AbstractProject<?,?> owner;

MavenProbeAction(AbstractProject<?,?> owner, Channel channel) {
MavenProbeAction(AbstractProject<?,?> owner, Channel channel, AbstractMavenBuild<?,?> build) {
this.channel = channel;
this.build = build;
this.owner = owner;
}

@@ -76,15 +82,39 @@ public String getUrlName() {
* If this is the master, it returns the system property of the master computer.
*/
public Map<Object,Object> getSystemProperties() throws IOException, InterruptedException {
return RemotingDiagnostics.getSystemProperties(channel);
Map<Object,Object> props = RemotingDiagnostics.getSystemProperties(channel);

if (build != null) {
final Set<String> sensitiveBuildVars = build.getSensitiveBuildVariables();
props = new TreeMap<Object, Object>(Maps.transformEntries(props,
new Maps.EntryTransformer<Object, Object, Object>() {
public Object transformEntry(Object key, Object value) {
return sensitiveBuildVars.contains(key.toString()) ? "********" : value;
}
}));
}

return props;
}

/**
* Gets the environment variables of the JVM on this computer.
* If this is the master, it returns the system property of the master computer.
*/
public Map<String,String> getEnvVars() throws IOException, InterruptedException {
return EnvVars.getRemote(channel);
EnvVars vars = EnvVars.getRemote(channel);

if (build != null) {
final Set<String> sensitiveBuildVars = build.getSensitiveBuildVariables();
vars = new EnvVars(Maps.transformEntries(vars,
new Maps.EntryTransformer<String, String, String>() {
public String transformEntry(String key, String value) {
return sensitiveBuildVars.contains(key) ? "********" : value;
}
}));
}

return vars;
}

/**

0 comments on commit 3e97072

Please sign in to comment.
You can’t perform that action at this time.