-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor
-
Component/s: script-security-plugin
-
Environment:Jenkins 2.89.3
Pipeline Groovy 2.53
Script Security Plugin 1.44
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]
}
}
}
}
}