org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.lang.String startsWith java.lang.String

Jenkins JIRA | Tom Ghyselinck | 2 years ago
  1. 0

    Hi, We have the following configuration in a matrix job: {code} <combinationFilter>label.startsWith(&apos;i386&apos;)</combinationFilter> {code} When the [Script Security Plugin|https://wiki.jenkins-ci.org/display/JENKINS/Script+Security+Plugin] is installed, we get the following error: {code} SEVERE: Failed Loading job MyJob org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.lang.String startsWith java.lang.String at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:150) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:77) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:103) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:100) at org.kohsuke.groovy.sandbox.impl.Checker$checkedCall.callStatic(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:50) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157) at Script1.run(Script1.groovy:1) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.run(GroovySandbox.java:139) at hudson.matrix.FilterScript.evaluate(FilterScript.java:45) at hudson.matrix.FilterScript.apply(FilterScript.java:85) at hudson.matrix.Combination.evalGroovyExpression(Combination.java:101) at hudson.matrix.Combination.evalGroovyExpression(Combination.java:91) at hudson.matrix.MatrixProject.rebuildConfigurations(MatrixProject.java:638) at hudson.matrix.MatrixProject.onLoad(MatrixProject.java:505) at hudson.model.Items.load(Items.java:279) at jenkins.model.Jenkins$17.run(Jenkins.java:2673) at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282) at jenkins.model.Jenkins$7.runTask(Jenkins.java:903) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) {code} *Note*: The current _workaround_ is to "_Approve_" the script via [http://<jenkins-url>/scriptApproval/]

    Jenkins JIRA | 2 years ago | Tom Ghyselinck
    org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.lang.String startsWith java.lang.String
  2. 0

    Hi, We have the following configuration in a matrix job: {code} <combinationFilter>label.startsWith(&apos;i386&apos;)</combinationFilter> {code} When the [Script Security Plugin|https://wiki.jenkins-ci.org/display/JENKINS/Script+Security+Plugin] is installed, we get the following error: {code} SEVERE: Failed Loading job MyJob org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.lang.String startsWith java.lang.String at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:150) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:77) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:103) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:100) at org.kohsuke.groovy.sandbox.impl.Checker$checkedCall.callStatic(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:50) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157) at Script1.run(Script1.groovy:1) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.run(GroovySandbox.java:139) at hudson.matrix.FilterScript.evaluate(FilterScript.java:45) at hudson.matrix.FilterScript.apply(FilterScript.java:85) at hudson.matrix.Combination.evalGroovyExpression(Combination.java:101) at hudson.matrix.Combination.evalGroovyExpression(Combination.java:91) at hudson.matrix.MatrixProject.rebuildConfigurations(MatrixProject.java:638) at hudson.matrix.MatrixProject.onLoad(MatrixProject.java:505) at hudson.model.Items.load(Items.java:279) at jenkins.model.Jenkins$17.run(Jenkins.java:2673) at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282) at jenkins.model.Jenkins$7.runTask(Jenkins.java:903) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) {code} *Note*: The current _workaround_ is to "_Approve_" the script via [http://<jenkins-url>/scriptApproval/]

    Jenkins JIRA | 2 years ago | Tom Ghyselinck
    org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.lang.String startsWith java.lang.String
  3. 0

    When groovy-postbuild uses {{GroovyPostbuildRecorder$BadgeManager.setBuildNumber}} in the script-security sandbox, the script fails with following log: {noformat} Groovy script failed: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified method org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder$BadgeManager setBuildNumber java.lang.Integer at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:63) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:111) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:108) at org.kohsuke.groovy.sandbox.impl.Checker$checkedCall.callStatic(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:50) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157) at Script1.run(Script1.groovy) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.run(GroovySandbox.java:119) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:160) at org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.perform(GroovyPostbuildRecorder.java:355) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:780) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:705) at hudson.model.Run.execute(Run.java:1617) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:237) {noformat} And it's not recorded to pending signatures.

    Jenkins JIRA | 2 years ago | ikedam
    org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified method org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder$BadgeManager setBuildNumber java.lang.Integer
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [JIRA] [script-security-plugin] (JENKINS-33468) CLONE - Sandbox cannot handle methods Groovy provides additionally

    Google Groups | 9 months ago | akostadinov@java.net (JIRA)
    org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified method java.lang.String toInteger
  6. 0

    Running a following script {code} "30".toInteger(); {code} Results following error: {noformat} org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified method java.lang.String toInteger at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:63) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:111) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:108) at org.kohsuke.groovy.sandbox.impl.Checker$checkedCall.callStatic(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:50) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157) at Script1.run(Script1.groovy) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.run(GroovySandbox.java:119) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:160) at org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.perform(GroovyPostbuildRecorder.java:355) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:780) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:705) at hudson.model.Run.execute(Run.java:1617) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:237) {noformat} It looks caused for {{String.toInteger()}} is not provided in JDK and additionally provided by Groovy.

    Jenkins JIRA | 2 years ago | ikedam
    org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified method java.lang.String toInteger

    7 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException

      Scripts not permitted to use method java.lang.String startsWith java.lang.String

      at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod()
    2. org.jenkinsci.plugins
      SandboxInterceptor.onMethodCall
      1. org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:150)
      2. org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:77)
      2 frames
    3. org.kohsuke.groovy
      Checker$checkedCall.callStatic
      1. org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:103)
      2. org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:100)
      3. org.kohsuke.groovy.sandbox.impl.Checker$checkedCall.callStatic(Unknown Source)
      3 frames
    4. Groovy
      AbstractCallSite.callStatic
      1. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:50)
      2. org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157)
      2 frames
    5. Unknown
      Script1.run
      1. Script1.run(Script1.groovy:1)
      1 frame
    6. org.jenkinsci.plugins
      GroovySandbox.run
      1. org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.run(GroovySandbox.java:139)
      1 frame
    7. Hudson
      Items.load
      1. hudson.matrix.FilterScript.evaluate(FilterScript.java:45)
      2. hudson.matrix.FilterScript.apply(FilterScript.java:85)
      3. hudson.matrix.Combination.evalGroovyExpression(Combination.java:101)
      4. hudson.matrix.Combination.evalGroovyExpression(Combination.java:91)
      5. hudson.matrix.MatrixProject.rebuildConfigurations(MatrixProject.java:638)
      6. hudson.matrix.MatrixProject.onLoad(MatrixProject.java:505)
      7. hudson.model.Items.load(Items.java:279)
      7 frames
    8. jenkins.model
      Jenkins$17.run
      1. jenkins.model.Jenkins$17.run(Jenkins.java:2673)
      1 frame
    9. init
      Reactor.runTask
      1. org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
      2. org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
      2 frames
    10. jenkins.model
      Jenkins$7.runTask
      1. jenkins.model.Jenkins$7.runTask(Jenkins.java:903)
      1 frame
    11. init
      Reactor$Node.run
      1. org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
      2. org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
      2 frames
    12. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      3. java.lang.Thread.run(Thread.java:745)
      3 frames