jenkinsci / jenkinsci/script-security-plugin
[JENKINS-48108] isMoreSpecific fails in script security for overloads
- Dominant language
- Java
- Stars
- 76
- Forks
- 181
- Avg merge
- 14h 55m
- Merged PRs (30d)
- 3
Description
I have the following methods:
def executeCake(String target, String configuration, Boolean failOnError, String... arguments) {
// Some fancy logic
}
def executeCake(String target, String configuration, String... arguments) {
executeCake(target, configuration, true, arguments)
}
Now when running this in Jenkins, it fails to find the correct method and ends in the following exception:
java.lang.IllegalStateException: cannot compare public java.lang.Object project.Utilities.executeCake(java.lang.String,java.lang.String,java.lang.Boolean,java.lang.String[]) to public java.lang.Object project.Utilities.executeCake(java.lang.String,java.lang.String,java.lang.String[])
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.isMoreSpecific(GroovyCallSiteSelector.java:250)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.findMatchingMethod(GroovyCallSiteSelector.java:196)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.method(GroovyCallSiteSelector.java:146)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:87)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:153)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:157)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at WorkflowScript.executeCake(WorkflowScript:164)
at WorkflowScript.run(WorkflowScript:83)
This is probably due to an incomplete implementation of choosing the most specific method:
---
Originally reported by
roemer, imported from: isMoreSpecific fails in script security for overloads
Raw content of original issue
I have the following methods:
def executeCake(String target, String configuration, Boolean failOnError, String... arguments) {
// Some fancy logic
}
def executeCake(String target, String configuration, String... arguments) {
executeCake(target, configuration, true, arguments)
}Now when running this in Jenkins, it fails to find the correct method and ends in the following exception:
java.lang.IllegalStateException: cannot compare public java.lang.Object project.Utilities.executeCake(java.lang.String,java.lang.String,java.lang.Boolean,java.lang.String[]) to public java.lang.Object project.Utilities.executeCake(java.lang.String,java.lang.String,java.lang.String[])
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.isMoreSpecific(GroovyCallSiteSelector.java:250)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.findMatchingMethod(GroovyCallSiteSelector.java:196)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.method(GroovyCallSiteSelector.java:146)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:87)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:153)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:157)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at WorkflowScript.executeCake(WorkflowScript:164)
at WorkflowScript.run(WorkflowScript:83)This is probably due to an incomplete implementation of choosing the most specific method:
- environment:
Jenkins 2.89
Contributor guide
Assessment
This issue has not been assessed yet.