jenkinsci / jenkinsci/script-security-plugin

[JENKINS-52436] Cannot evaluate ArrayList.size or first inside Groovy Sandbox

Open
#805 0 comments 0 reactions 0 assignees View on GitHub
component:script-security-plugin imported-jira-issue priority:major resolution:unresolved
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.



  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 !

 

---
Originally reported by michaelp, imported from: Cannot evaluate ArrayList.size or first inside Groovy Sandbox


  • status: Open
  • priority: Major
  • component(s): script-security-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-09

Raw content of original issue

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 !

 

  • environment: Script Security Plugin 1.44

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.