Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-34592

unclassified method java.lang.String[] getAt java.lang.Integer

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • script-security-plugin
    • None
    • Jenkins 1.652 script-security-plugin 1.19

      The signature doesnt get listed on the approve page

      Jenkinsfile:
      node ('master') {
      checkout scm

      def PLATFORMS = readFile('.platform').trim()
      env.PLATFORMS = PLATFORMS
      def eppo = []
      def stepsForParallel = [:]
      eppo = PLATFORMS.split(",")

      for (int i = 0; i < eppo.size(); i++)

      { def s = eppo.getAt(i) println ("platform: $s") }

      }

      Trace:
      org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified method java.lang.String[] getAt java.lang.Integer
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:113)
      at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
      at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
      at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:15)
      at WorkflowScript.run(WorkflowScript:17)
      at __cps.transform__(Native Method)
      at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:55)
      at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:106)
      at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:79)
      at sun.reflect.GeneratedMethodAccessor204.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      at com.cloudbees.groovy.cps.impl.LocalVariableBlock$LocalVariable.get(LocalVariableBlock.java:33)
      at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
      at com.cloudbees.groovy.cps.impl.LocalVariableBlock.evalLValue(LocalVariableBlock.java:22)
      at com.cloudbees.groovy.cps.LValueBlock$BlockImpl.eval(LValueBlock.java:55)
      at com.cloudbees.groovy.cps.LValueBlock.eval(LValueBlock.java:16)
      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:19)
      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:164)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:277)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:77)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:186)
      at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:184)
      at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      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:471)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      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)
      Finished: FAILURE

          [JENKINS-34592] unclassified method java.lang.String[] getAt java.lang.Integer

          Andrew Bayer added a comment -

          jglick - I can't figure out how to add this to the generic whitelist - I get

          {method java.lang.String[] getAt java.lang.Integer does not exist (or is an override)}

          and when I try

          {int}

          or

          {java.lang.Object[]}

          , same thing. Any ideas on arrays?

          Andrew Bayer added a comment - jglick - I can't figure out how to add this to the generic whitelist - I get {method java.lang.String[] getAt java.lang.Integer does not exist (or is an override)} and when I try {int} or {java.lang.Object[]} , same thing. Any ideas on arrays?

          Hi Andrew,
          I am running into similar problem myself.
          I was to add all other methods into XML file scriptApproval.xml. But, when I add "unclassified method" to whitelist in xml file, it starts to ignore the rest of the whitelist... Have you figured out how to add it?
          Thanks!

          Sasha Shkolnik added a comment - Hi Andrew, I am running into similar problem myself. I was to add all other methods into XML file scriptApproval.xml. But, when I add "unclassified method" to whitelist in xml file, it starts to ignore the rest of the whitelist... Have you figured out how to add it? Thanks!

          Jesse Glick added a comment -

          abayer because this is in DefaultGroovyMethods, perhaps. TBD.

          sshkolni do not do that.

          Jesse Glick added a comment - abayer because this is in DefaultGroovyMethods , perhaps. TBD. sshkolni do not do that.

          Thomas Gimpel added a comment -

          Same problem here. The Jenkinsfile runs fine as a pipeline project, but not as a multi branch pipeline. It is not possible to approve the MyClass[] getAt java.lang.Integer method, because it is not listed on the approve page. Any suggestions how to fix or work-around that blocking problem existing for 7 months?

          Thomas Gimpel added a comment - Same problem here. The Jenkinsfile runs fine as a pipeline project, but not as a multi branch pipeline. It is not possible to approve the MyClass[] getAt java.lang.Integer method, because it is not listed on the approve page. Any suggestions how to fix or work-around that blocking problem existing for 7 months?

          Thomas Gimpel added a comment -

          Replacing a.getAt(index) by a[index] works for me.

          Thomas Gimpel added a comment - Replacing a.getAt(index) by a [index] works for me.

          J Knurek added a comment -

          I also experienced this bug, and the work-around suggested by Thomas fixed it:

          Replacing a.getAt(index) by a[index]

          J Knurek added a comment - I also experienced this bug, and the work-around suggested by Thomas fixed it: Replacing a.getAt(index) by a [index]

          Ilia Shakitko added a comment -

          The fix from Thomas doesn't work if this code is in Jenkinsfile...

          Ilia Shakitko added a comment - The fix from Thomas doesn't work if this code is in Jenkinsfile...

          Andrew Bayer added a comment -

          As of workflow-cps 2.40 and script-security 1.34, this works, so I'm marking this as fixed.

          Andrew Bayer added a comment - As of workflow-cps 2.40 and script-security 1.34, this works, so I'm marking this as fixed.

            jglick Jesse Glick
            mansm mans matulewicz
            Votes:
            7 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: