jenkinsci / jenkinsci/script-security-plugin

[JENKINS-50869] Calling `empty` on Groovy list leads to a list being returned, not correct check

Open
#797 1 comment 0 reactions 0 assignees View on GitHub
component:script-security-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
76
Forks
181
Avg merge
14h 55m
Merged PRs (30d)
3

Description

Steps to reproduce:



  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

 

def someArrayList = []

println someArrayList.empty


This works when the sandbox is disabled, but when sandbox is enabled it returns

[]


Instead of

true


like it should.

After downgrading back from Script Security 1.44 to 1.43 the problem is fixed.

I suspect https://issues.jenkins-ci.org/browse/JENKINS-50470 is the problem

---
Originally reported by kylec_32, imported from: Calling `empty` on Groovy list leads to a list being returned, not correct check


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

Raw content of original issue

Steps to reproduce:



  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

 



def someArrayList = []

println someArrayList.empty



This works when the sandbox is disabled, but when sandbox is enabled it returns



[]



Instead of



true



like it should.

After downgrading back from Script Security 1.44 to 1.43 the problem is fixed.
I suspect https://issues.jenkins-ci.org/browse/JENKINS-50470 is the problem

environment

```
Jenkins 2.117

Script Security 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.