[JIRA] (JENKINS-37479) Unclassified staticMethod java.nio.file.Paths get java.lang.String

14 views
Skip to first unread message

roytinker@gmail.com (JIRA)

unread,
Aug 17, 2016, 2:14:01 PM8/17/16
to jenkinsc...@googlegroups.com
Roy Tinker created an issue
 
Jenkins / Bug JENKINS-37479
Unclassified staticMethod java.nio.file.Paths get java.lang.String
Issue Type: Bug Bug
Assignee: Jesse Glick
Components: workflow-plugin
Created: 2016/Aug/17 6:13 PM
Environment: Jenkins 1.658
Labels: workflow
Priority: Minor Minor
Reporter: Roy Tinker

When attempting to run the expression java.nio.file.Paths.get("/some/path"), I get the following error:

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified staticMethod java.nio.file.Paths get java.lang.String

Also, no approval appears at /scriptApproval.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

roytinker@gmail.com (JIRA)

unread,
Aug 17, 2016, 2:16:02 PM8/17/16
to jenkinsc...@googlegroups.com
Roy Tinker updated an issue
Change By: Roy Tinker
When attempting to run the expression {{java.nio.file.Paths.get("/some/path")}} in a sandboxed pipeline script , I get the following error:


{{org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified staticMethod java.nio.file.Paths get java.lang.String}}

Also, no approval appears at /scriptApproval.

roytinker@gmail.com (JIRA)

unread,
Aug 17, 2016, 2:16:02 PM8/17/16
to jenkinsc...@googlegroups.com
Roy Tinker updated an issue
When attempting to run the expression {{ new String( java.nio.file. Files.readAllBytes(java.nio.file. Paths.get("/some/path") )) }} in a sandboxed pipeline script, I get the following error:


{{org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified staticMethod java.nio.file.Paths get java.lang.String}}

Also, no approval appears at /scriptApproval.

gabrielkonat@gmail.com (JIRA)

unread,
Oct 7, 2016, 5:40:05 AM10/7/16
to jenkinsc...@googlegroups.com
Gabriel Konat commented on Bug JENKINS-37479
 
Re: Unclassified staticMethod java.nio.file.Paths get java.lang.String

Same problem here on Jenkins 2.23. Static method is rejected, but does not show up in the 'In-process Script Approval' page. I even manually added 'staticMethod java.lang.Math round java.math.BigDecimal' as an approved signature to the script approval XML file and restarted Jenkins, but the method is still rejected.

Exception:

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified staticMethod java.lang.Math round java.math.BigDecimal
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onStaticCall(SandboxInterceptor.java:138)
	at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:180)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedStaticCall(Checker.java:177)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:91)
	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
	at WorkflowScript.createMessage(WorkflowScript:177)
	at WorkflowScript.notifyFail(WorkflowScript:190)
	at WorkflowScript.run(WorkflowScript:140)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:48)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
	at sun.reflect.GeneratedMethodAccessor279.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:50)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
	at sun.reflect.GeneratedMethodAccessor279.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	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:58)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	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:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

jglick@cloudbees.com (JIRA)

unread,
Oct 7, 2016, 5:03:02 PM10/7/16
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
 
Change By: Jesse Glick
Component/s: script-security-plugin
Component/s: pipeline

jglick@cloudbees.com (JIRA)

unread,
Oct 7, 2016, 5:03:02 PM10/7/16
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-37479
 
Re: Unclassified staticMethod java.nio.file.Paths get java.lang.String

“Unclassified method” errors generally indicate a bug in the script-security plugin; there is nothing to approve because it means Jenkins was unable to determine what the script was attempting to call. For diagnosis please supply a complete, minimal script reproducing the error.

gabrielkonat@gmail.com (JIRA)

unread,
Oct 8, 2016, 4:17:07 AM10/8/16
to jenkinsc...@googlegroups.com

I see. The following pipeline script triggers the exception:

echo Math.round(currentBuild.duration / 1000)

garciagonzalez.julien@gmail.com (JIRA)

unread,
Oct 17, 2016, 6:08:03 AM10/17/16
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Feb 23, 2018, 1:50:04 PM2/23/18
to jenkinsc...@googlegroups.com
Andrew Bayer resolved as Cannot Reproduce
 

At least as of script-security 1.41, I can't reproduce the original error from new String(java.nio.file.Files.readAllBytes(java.nio.file.Paths.get("/some/path"))), so I'm closing this.

For any other method calls that produce an unclassified staticMethod ... error, please open a new ticket.

Change By: Andrew Bayer
Status: Open Resolved
Resolution: Cannot Reproduce
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages