Skip to content

Commit

Permalink
Merge pull request #139 from abayer/jenkins-46088
Browse files Browse the repository at this point in the history
[JENKINS-46088] Verify removal of double transform of cast expression
  • Loading branch information
abayer committed Aug 16, 2017
2 parents ea5ce36 + bd3a6ab commit 7a81a07
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -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>
Expand Down
Expand Up @@ -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.