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

Cannot evaluate ArrayList.size or first inside Groovy Sandbox

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Might be related to JENKINS-50470, some people commented there that they have this problem.

      1. Create a freestyle job
      2. Add "Execute system Groovy script" build step
      3. Add content (see below)
      4. Run build with "Use Groovy Sandbox" enabled.
      5. Run without "Use Groovy Sandbox" enabled

      Script content:

      def someList = [1, 2, 3]
      println someList.size

      When the sandbox is enabled we have the following message :
      ERROR: Build step failed with exceptionorg.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: No such field found: field hudson.slaves.EnvironmentVariablesNodeProperty size
      It is not a field but a method, called without parentheses. It breaks many of our scripts, using methods such as first or size.

       

      Thanks for your help !

       

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            michaelp Michael Piffret
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: