When running a workflow in sandbox mode, if a method call is not authorized, the build log currently shows the stacktrace.

      Caused by: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.util.Map values
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:158)
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:80)
      	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 Script2.getJenkinsVersion(Script2.groovy:30)
      	at Script2.stashJenkinsWar(Script2.groovy:90)
      	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.fixName(FunctionCallBlock.java:74)
      	at sun.reflect.GeneratedMethodAccessor244.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)
      	... 22 more
      

      It would be more useful to display a link to the script approval panel provided the user has the right permissions.

      Even better, direct link to approve the particular method call.
      Even even better, pause the workflow for script approval, then resume after approval or fail if denied (but here I know I'm dreaming).

          [JENKINS-33614] Link to script approval from build console

          Jesse Glick added a comment -

          resume after approval

          I would love to do this, but am not sure how.

          Jesse Glick added a comment - resume after approval I would love to do this, but am not sure how.

          Andrew Bayer added a comment -

          PR up to add a console log link to the script approval page when a RejectedAccessException pops up.

          Andrew Bayer added a comment - PR up to add a console log link to the script approval page when a RejectedAccessException pops up.

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/cps/SandboxContinuable.java
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Messages.properties
          src/test/java/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition2Test.java
          http://jenkins-ci.org/commit/workflow-cps-plugin/7eddd974002b2623644a18fa19d58aa54faef2a4
          Log:
          [FIXED JENKINS-33614] Add link to script approval when a rejection occurs

          I don't love this, so feel free to critique/veto.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/org/jenkinsci/plugins/workflow/cps/SandboxContinuable.java src/main/resources/org/jenkinsci/plugins/workflow/cps/Messages.properties src/test/java/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition2Test.java http://jenkins-ci.org/commit/workflow-cps-plugin/7eddd974002b2623644a18fa19d58aa54faef2a4 Log: [FIXED JENKINS-33614] Add link to script approval when a rejection occurs I don't love this, so feel free to critique/veto.

          Andrew Bayer added a comment -

          This'll be in workflow-cps 2.46.

          Andrew Bayer added a comment - This'll be in workflow-cps 2.46.

            abayer Andrew Bayer
            vlatombe Vincent Latombe
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: