This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_4_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY_4_0_X by this push: new bc5122e2c4 Revert "GROOVY-11170: Fix edge cases for SecureASTCustomizer (test cases)" (Wrong branch) bc5122e2c4 is described below commit bc5122e2c4afff47a90eb27844f06f91756bd3d7 Author: Paul King <pa...@asert.com.au> AuthorDate: Sun Sep 10 12:04:34 2023 +1000 Revert "GROOVY-11170: Fix edge cases for SecureASTCustomizer (test cases)" (Wrong branch) This reverts commit 5e885847a7cf051ee1a66bdb570fec7f30af9a64. --- .../customizers/SecureASTCustomizerTest.groovy | 85 ---------------------- 1 file changed, 85 deletions(-) diff --git a/src/test/org/codehaus/groovy/control/customizers/SecureASTCustomizerTest.groovy b/src/test/org/codehaus/groovy/control/customizers/SecureASTCustomizerTest.groovy index 2d97443fa7..befa5f0335 100644 --- a/src/test/org/codehaus/groovy/control/customizers/SecureASTCustomizerTest.groovy +++ b/src/test/org/codehaus/groovy/control/customizers/SecureASTCustomizerTest.groovy @@ -23,7 +23,6 @@ import org.codehaus.groovy.ast.expr.ConstantExpression import org.codehaus.groovy.ast.expr.MethodCallExpression import org.codehaus.groovy.control.CompilerConfiguration import org.codehaus.groovy.control.MultipleCompilationErrorsException -import org.codehaus.groovy.runtime.InvokerHelper import org.codehaus.groovy.syntax.Types import org.junit.Before import org.junit.Test @@ -535,16 +534,6 @@ final class SecureASTCustomizerTest { 1.plus(1) } ''') - shell.evaluate(''' - def main(args) { - 1.plus(1) - } - ''') - shell.evaluate(''' - def run() { - 1.plus(1) - } - ''') assert hasSecurityException { shell.evaluate(''' static main(args) { @@ -552,20 +541,6 @@ final class SecureASTCustomizerTest { } ''') } - assert hasSecurityException { - shell.evaluate(''' - def main(args) { - "string".toUpperCase() - } - ''') - } - assert hasSecurityException { - shell.evaluate(''' - def run() { - "string".toUpperCase() - } - ''') - } assert hasSecurityException { shell.evaluate(''' static main(args) { @@ -586,20 +561,6 @@ final class SecureASTCustomizerTest { } } ''') - shell.evaluate(''' - class Dummy { - def main(args) { - 1.plus(1) - } - } - ''') - shell.evaluate(''' - class Dummy { - def run() { - 1.plus(1) - } - } - ''') assert hasSecurityException { shell.evaluate(''' class Dummy { @@ -609,24 +570,6 @@ final class SecureASTCustomizerTest { } ''') } - assert hasSecurityException { - shell.evaluate(''' - class Dummy { - def main(args) { - "string".toUpperCase() - } - } - ''') - } - assert hasSecurityException { - shell.evaluate(''' - class Dummy { - def run() { - "string".toUpperCase() - } - } - ''') - } assert hasSecurityException { shell.evaluate(''' class Dummy { @@ -649,34 +592,6 @@ final class SecureASTCustomizerTest { } } - @Test - void testDisallowedReceiversInvokerHelperEdgeCase() { - assert 'a,b' == InvokerHelper.invokeStaticMethod(String, 'join', [',', ['a', 'b']] as Object[]) - customizer.disallowedReceiversClasses = [InvokerHelper] - def shell = new GroovyShell(configuration) - shell.evaluate(''' - def run() { - assert 'a,b' == String.join(',', ['a', 'b']) - } - ''') - shell.evaluate(''' - def main() { - assert 'a,b' == String.join(',', ['a', 'b']) - } - ''') - shell.evaluate(''' - static main(args) { - assert 'a,b' == String.join(',', ['a', 'b']) - } - ''') - assert hasSecurityException { - shell.evaluate(''' - import org.codehaus.groovy.runtime.InvokerHelper - InvokerHelper.invokeStaticMethod(String, 'join', [',', ['a', 'b']] as Object[]) - ''') - } - } - @Test void testAllowedReceiversWithStaticMethod() { customizer.allowedReceiversClasses = [Integer.TYPE]