1. Create a multibranch pipeline inside a folder 2. Configure Folder properties with Name: "testURL" Value"http://10.**.**.**:****"
In JenkinsfileScript content: {code:java} def someArrayList = []
println someArrayListwithFolderProperties{ echo "URL STEP 1: ${env.nametestURL}" } {code} This works with Sandbox disabled. When enabled, theThe following exception is thrown: {noformat} ERRORNo such field found: Build step failed with exception field java.lang.String mapiURL. Administrators can decide whether to approve or reject this signature. [Pipeline] End of Pipeline org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: No such field found: field java.utillang.ArrayList nameString mapiURL at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:397425) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:381409) at org.kohsuke.groovy.sandbox.impl.Checker$67.call(Checker.java:288353) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:292357) at org com.kohsukecloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29) at com.cloudbees.groovy.cps.impl.CheckerPropertyAccessBlock.rawGet(PropertyAccessBlock.java:20) at WorkflowScript.run(WorkflowScript:94) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.PropertyishBlock$checkedGetPropertyContinuationImpl.callStaticget(PropertyishBlock.java:74) at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66) at sun.reflect.GeneratedMethodAccessor461.invoke(Unknown Source) at org sun.codehausreflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.cloudbees.groovy.runtimecps.callsiteimpl.CallSiteArrayContinuationPtr$ContinuationImpl.defaultCallStaticreceive(CallSiteArrayContinuationPtr.java:5672) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:83) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) at org.codehaus.groovy.runtime.callsiteGroovyCategorySupport$ThreadCategoryInfo.AbstractCallSite.callStaticuse(AbstractCallSiteGroovyCategorySupport.java:194129) at org.codehaus.groovy.runtime.callsiteGroovyCategorySupport.AbstractCallSiteuse(GroovyCategorySupport.callStaticjava:268) at com.cloudbees.groovy.cps.Continuable.run0(AbstractCallSiteContinuable.java:230163) at Script1 org.runjenkinsci.plugins.workflow.cps.SandboxContinuable.access$101(Script1SandboxContinuable.groovyjava:334) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.lambda$run0$0(SandboxContinuable.java:59) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runrunInSandbox(GroovySandbox.java:141237) at org.jenkinsci.plugins.scriptsecurityworkflow.sandboxcps.groovySandboxContinuable.SecureGroovyScriptrun0(SandboxContinuable.evaluatejava:58) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(SecureGroovyScriptCpsThread.java:333174) at hudson org.jenkinsci.plugins.groovyworkflow.SystemGroovycps.CpsThreadGroup.run(SystemGroovyCpsThreadGroup.java:95347) at hudson org.jenkinsci.plugins.groovyworkflow.SystemGroovycps.performCpsThreadGroup.access$200(SystemGroovyCpsThreadGroup.java:5993) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:259) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:247) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.tasksremoting.BuildStepMonitorSingleLaneExecutorService$1.performrun(BuildStepMonitorSingleLaneExecutorService.java:20131) at hudson jenkins.modelutil.AbstractBuildContextResettingExecutorService$AbstractBuildExecution1.performrun(AbstractBuildContextResettingExecutorService.java:74428) at hudson jenkins.modelsecurity.BuildImpersonatingExecutorService$BuildExecution1.buildrun(BuildImpersonatingExecutorService.java:20659) Caused: java.util.concurrent.ExecutionException at hudson org.modeljenkinsci.Buildplugins.workflow.cps.CpsBodyExecution.get(CpsBodyExecution.java:308) at com.mig82.folders.step.FolderPropertiesStep$BuildExecutionExecution.doRunrun(BuildFolderPropertiesStep.java:16355) at hudson com.modelmig82.AbstractBuildfolders.step.FolderPropertiesStep$AbstractBuildExecutionExecution.run(AbstractBuildFolderPropertiesStep.java:50437) at hudson org.modeljenkinsci.Runplugins.executeworkflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(RunAbstractSynchronousNonBlockingStepExecution.java:172447) at hudson.modelsecurity.FreeStyleBuildACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(FreeStyleBuildAbstractSynchronousNonBlockingStepExecution.java:4344) at hudson java.modelutil.ResourceControllerconcurrent.executeExecutors$RunnableAdapter.call(ResourceControllerExecutors.java:97511) at hudson java.modelutil.Executorconcurrent.FutureTask.run(ExecutorFutureTask.java:429266) Build step 'Execute system Groovy script' marked build as failure at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE {noformat} It looks like, outside the sandbox, groovy evaluates {code:java} someArrayList.name {code} to {code:java} someArrayList.collect { it.name } {code} but inside the sandbox, this doesn't happen. Feedback from Andrew: {quote}fwiw, it's [https://github.com/apache/groovy/blob/eedc6bfcd134749e7d76b05031dfbd914cec2d6e/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L7855] we need to somehow handle - we have to check the contents of the list to see if the objects in there can have that field accessed. {quote} The workaround currently is to change to using: {code:java} someArrayList.collect {it.name } {code} when using the sandbox.
No such field found: field java.lang.String mapiURL testURL. Administrators can decide whether to approve or reject this signature. [Pipeline] End of Pipeline org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: No such field found: field java.lang.String mapiURL tesURL at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:425) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:409) at org.kohsuke.groovy.sandbox.impl.Checker$7.call(Checker.java:353) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:357) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29) at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
at WorkflowScript.run(WorkflowScript:94) at ___cps.transform___(Native Method)
at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:74)
at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66) at sun.reflect.GeneratedMethodAccessor461.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:83) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129) at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$101(SandboxContinuable.java:34) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.lambda$run0$0(SandboxContinuable.java:59) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:237) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:58) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:347) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:259) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:247) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64) at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59) Caused: java.util.concurrent.ExecutionException at org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.get(CpsBodyExecution.java:308) at com.mig82.folders.step.FolderPropertiesStep$Execution.run(FolderPropertiesStep.java:55) at com.mig82.folders.step.FolderPropertiesStep$Execution.run(FolderPropertiesStep.java:37) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE {noformat}
It looks like, outside the sandbox, groovy evaluates {code:java} someArrayList.name {code} to {code:java} someArrayList.collect { it.name } {code}
2. Configure Folder properties with Name: "testURL" & Value"http://10.**.**.**:****"
In Jenkinsfile Script content: {code:java} withFolderProperties{ echo "URL STEP 1: ${env.testURL}" } {code} The following exception is thrown: {noformat}
No such field found: field java.lang.String testURL. Administrators can decide whether to approve or reject this signature. [Pipeline] End of Pipeline org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: No such field found: field java.lang.String tesURL