Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9318

SecureASTCustomizer: add support for allowing or blocking entire package trees

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0.0-alpha-1
    • None
    • None

    Description

      Consider the following:

      CompilerConfiguration configuration = new CompilerConfiguration()
      SecureASTCustomizer customizer = new SecureASTCustomizer()
      configuration.addCompilationCustomizers(customizer)
      customizer.starImportsBlacklist = ['javax.**']
      def shell = new GroovyShell(configuration)
      shell.evaluate('''
        import javax.swing.Action
        Action act
      ''')
      

      This should throw SecurityException since all of "javax" packages have been blocked.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment