Skip to content

Commit

Permalink
[FIXED JENKINS-25914] Allow the env pseudo-property to be accessed ev…
Browse files Browse the repository at this point in the history
…en when using sandboxed scripts.

Originally-Committed-As: 0ee3e93e78013326cb49f800055c21f6044e6ce1
  • Loading branch information
jglick committed Dec 4, 2014
1 parent a54a191 commit c327ece
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Expand Up @@ -625,7 +625,7 @@ public static void finish(final boolean terminate) {
+ " semaphore 'env'\n"
+ " env.BUILD_TAG=\"${env.BUILD_TAG}2\"\n"
+ " sh 'echo tag3=$BUILD_TAG stuff=$STUFF'\n"
+ "}"));
+ "}", true));
startBuilding();
SemaphoreStep.waitForStart("env/1", b);
assertTrue(b.isBuilding());
Expand Down
Expand Up @@ -8,6 +8,8 @@

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;

/**
* {@link Whitelist} implementation for CPS flow execution.
Expand All @@ -34,6 +36,16 @@ public boolean permitsMethod(Method method, Object receiver, Object[] args) {
// These are just aliases for EchoStep.
return true;
}
if (name.equals("getProperty") && Arrays.asList(args).equals(Collections.singletonList("env"))) {
return true;
}
}
// TODO JENKINS-24982: it would be nice if AnnotatedWhitelist accepted @Whitelisted on an override
if (receiver instanceof EnvActionImpl) {
String name = method.getName();
if (name.equals("getProperty") || name.equals("setProperty")) {
return true;
}
}
return false;
}
Expand Down

0 comments on commit c327ece

Please sign in to comment.