Skip to content
Permalink
Browse files

Merge pull request #139 from abayer/jenkins-46088

[JENKINS-46088] Verify removal of double transform of cast expression
  • Loading branch information...
abayer committed Aug 16, 2017
2 parents ea5ce36 + bd3a6ab commit 7a81a076e46e8638a80313bca2a9d5eaf3c56b24
@@ -47,7 +47,7 @@
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>groovy-sandbox</artifactId>
<version>1.13</version>
<version>1.14</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
@@ -848,4 +848,17 @@ public static void assertRejected(Whitelist whitelist, String expectedSignature,
// control: trying to call an existing method that's not safe
assertRejected(new GenericWhitelist(), "method java.lang.Class getClassLoader", "[].class.classLoader");
}

@Issue("JENKINS-46088")
@Test
public void matcherTypeAssignment() throws Exception {
assertEvaluate(new GenericWhitelist(), "goodbye world", "def text = 'hello world'; java.util.regex.Matcher matcher = text =~ 'hello (.+)'; matcher ? \"goodbye ${matcher[0][1]}\" : 'fail'");
}

@Issue("JENKINS-46088")
@Test
public void rhsOfDeclarationTransformed() throws Exception {
assertRejected(new StaticWhitelist(), "staticMethod jenkins.model.Jenkins getInstance", "jenkins.model.Jenkins x = jenkins.model.Jenkins.getInstance()");
}

}

0 comments on commit 7a81a07

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