You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by ywelsch <gi...@git.apache.org> on 2016/01/25 18:29:53 UTC

[GitHub] groovy pull request: Generate closures as public classes

GitHub user ywelsch opened a pull request:

    https://github.com/apache/groovy/pull/248

    Generate closures as public classes

    Groovy is the default scripting language in Elasticsearch, used to evaluate custom expressions. In Elasticsearch 2.0 we introduced the Java security manager as a key component to secure our software. We spent a lot of effort on getting Groovy to run under the security manager with a conservative set of permissions. We have currently hit a road block with the `suppressAccessCheck` which allows suppressing the standard language access checks and expose information that would normally be unavailable to malicious code. Unfortunately, not providing this permission to Groovy breaks the use of Groovy closures in our scripts.
    
    The reason is that in the Groovy framework:
    
    - Closures are generated as package private classes.
    - Access to closures is cached by the Groovy runtime using the class `CachedMethod`.
    
    Invoking a closure thus fails without the `suppressAccessCheck` permission as the class of the closure is package private but accessed from the Groovy runtime class `CachedMethod` in the `org.codehaus.groovy.reflection` package.
    
    This one-line PR changes the access modifier of the classes generated for Groovy closures from package-private to public.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ywelsch/groovy fix/package-private-closures

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/248.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #248
    
----
commit ec1c71014bbe09927c9ad690583ef4389edf93fe
Author: Yannick Welsch <ya...@elastic.co>
Date:   2016-01-25T16:27:41Z

    Generate closures as public classes

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] groovy pull request: Generate closures as public classes

Posted by ywelsch <gi...@git.apache.org>.
Github user ywelsch closed the pull request at:

    https://github.com/apache/groovy/pull/248


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---