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

List[Range] operator not permitted in sandbox

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Using the range operator to slice a list (see), even inside a script block, causes the below error:

       

      Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods getAt java.util.List java.util.Collection. Administrators can decide whether to approve or reject this signature.
      [Pipeline] End of Pipeline
      org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods getAt java.util.List java.util.Collection
              at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectStaticMethod(StaticWhitelist.java:189)
              at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetArray(SandboxInterceptor.java:447)
              at org.kohsuke.groovy.sandbox.impl.Checker$10.call(Checker.java:419)
              at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetArray(Checker.java:424)
              at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getArray(SandboxInvoker.java:45)
              at com.cloudbees.groovy.cps.impl.ArrayAccessBlock.rawGet(ArrayAccessBlock.java:21)
              at WorkflowScript.run(WorkflowScript:15)
      

       

      To reproduce, use the below pipeline script:

       

      pipeline {
          agent any
          
          stages {
              stage ('Run') {
                  steps {
                      script {
                          [1, 2, 3][1..2]
                      }
                  }
              }
          }
      }
      

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            abayer Andrew Bayer
            Reporter:
            haridsv Hari Dara
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: