jenkinsci / jenkinsci/script-security-plugin
[JENKINS-52436] Cannot evaluate ArrayList.size or first inside Groovy Sandbox
- Dominant language
- Java
- Stars
- 76
- Forks
- 181
- Avg merge
- 14h 55m
- Merged PRs (30d)
- 3
Description
Might be related to JENKINS-50470">JENKINS-50470, some people commented there that they have this problem.
- Create a freestyle job
- Add "Execute system Groovy script" build step
- Add content (see below)
- Run build with "Use Groovy Sandbox" enabled.
- 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 !
---
Originally reported by michaelp, imported from: Cannot evaluate ArrayList.size or first inside Groovy Sandbox
Raw content of original issue
Might be related to
JENKINS-50470, some people commented there that they have this problem.
- Create a freestyle job
- Add "Execute system Groovy script" build step
- Add content (see below)
- Run build with "Use Groovy Sandbox" enabled.
- Run without "Use Groovy Sandbox" enabled
Script content:
def someList = [1, 2, 3]
println someList.sizeWhen 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 !
- environment:
Script Security Plugin 1.44
Contributor guide
Assessment
This issue has not been assessed yet.