Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43480

security sandbox disallows groovy implicit class constructors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Duplicate
    • Component/s: script-security-plugin
    • Labels:
      None
    • Environment:
      jenkins 2.19.4
      script-security 1.27
    • Similar Issues:

      Description

      The sandbox appears to be unhappy with groovy classes unless they have an explicit constructor. Eg.

      class Foo {
          String bar
      }
      
      def f = new Foo(bar: 'baz')
      echo f.bar
      

      Blows up with:

      org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified new Foo java.util.LinkedHashMap
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onNewInstance(SandboxInterceptor.java:126)
      ...
      

      While it is happy with:

      class Foo {
          String bar
          
          Foo(String b) {
              this.bar = b
          }
      }
      
      def f = new Foo('baz')
      echo f.bar

        Attachments

          Issue Links

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                jhoblitt Joshua Hoblitt
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: