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

pre-send script fails: Rejecting unsandboxed super constructor call: hudson.plugins.emailext.plugins.content.EmailExtScript()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: email-ext-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.263.4
      Groovy 2.2
      Email Extension 2.72
      Script Security Plugin 1.76
    • Similar Issues:

      Description

      While using EmailExt in Freestyle job together with using it's "Pre-send Script" feature,
      it started failing for us (results in always sending the email) with java/groovy exception.

      Example pre-script used which causes the failure (have slightly more complex ones too, but even this seems to cause the issue):

      <presendScript>cancel = ( build.getResult() == build.previousBuild?.getResult() )</presendScript>
      

      Maybe it become incompatible with sandbox/script-security? I found no checkbox in job configuration for enabling/disabling sandbox for this groovy (like in pipeline jobs) so couldn't try how it behaves when switched. Would assume same would apply to Post-send Script but did not tested.

      ...
      Successfully created MimeMessage
      Executing pre-send script
      groovy.lang.GroovyRuntimeException: Failed to create Script instance for class: class Script1. Reason: java.lang.SecurityException: Rejecting unsandboxed super constructor call: hudson.plugins.emailext.plugins.content.EmailExtScript()
      	at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:466)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:736)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:727)
      	at hudson.plugins.emailext.ExtendedEmailPublisher.executeScript(ExtendedEmailPublisher.java:621)
      	at hudson.plugins.emailext.ExtendedEmailPublisher.executePresendScript(ExtendedEmailPublisher.java:571)
      	at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:455)
      	at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:441)
      	at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:349)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:753)
      	at hudson.model.Build$BuildExecution.cleanUp(Build.java:187)
      	at hudson.model.Run.execute(Run.java:1954)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Caused by: java.lang.SecurityException: Rejecting unsandboxed super constructor call: hudson.plugins.emailext.plugins.content.EmailExtScript()
      	at org.kohsuke.groovy.sandbox.impl.RejectEverythingInterceptor.onSuperConstructor(RejectEverythingInterceptor.java:64)
      	at org.kohsuke.groovy.sandbox.impl.Checker$5.call(Checker.java:249)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedSuperConstructor(Checker.java:253)
      	at org.kohsuke.groovy.sandbox.impl.Checker$checkedSuperConstructor.callStatic(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
      	at Script1.<init>(Script1.groovy)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      	at java.lang.Class.newInstance(Class.java:442)
      	at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:434)
      	... 16 more
      
      groovy.lang.GroovyRuntimeException: Failed to create Script instance for class: class Script1. Reason: java.lang.SecurityException: Rejecting unsandboxed super constructor call: hudson.plugins.emailext.plugins.content.EmailExtScript()
      	at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:466)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:736)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:727)
      	at hudson.plugins.emailext.ExtendedEmailPublisher.executeScript(ExtendedEmailPublisher.java:621)
      	at hudson.plugins.emailext.ExtendedEmailPublisher.executePresendScript(ExtendedEmailPublisher.java:571)
      	at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:455)
      	at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:441)
      	at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:349)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:753)
      	at hudson.model.Build$BuildExecution.cleanUp(Build.java:187)
      	at hudson.model.Run.execute(Run.java:1954)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Caused by: java.lang.SecurityException: Rejecting unsandboxed super constructor call: hudson.plugins.emailext.plugins.content.EmailExtScript()
      	at org.kohsuke.groovy.sandbox.impl.RejectEverythingInterceptor.onSuperConstructor(RejectEverythingInterceptor.java:64)
      	at org.kohsuke.groovy.sandbox.impl.Checker$5.call(Checker.java:249)
      	at org.kohsuke.groovy.sandbox.impl.Checker.checkedSuperConstructor(Checker.java:253)
      	at org.kohsuke.groovy.sandbox.impl.Checker$checkedSuperConstructor.callStatic(Unknown Source)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
      	at Script1.<init>(Script1.groovy)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      	at java.lang.Class.newInstance(Class.java:442)
      	at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:434)
      	... 16 more
      
      Sending email to: some-email@somewhere
      Finished: SUCCESS
      

        Attachments

          Activity

          Hide
          basil Basil Crow added a comment -

          Hi Queria Sa-Tas, can you please provide detailed steps to reproduce the problem from scratch? Please also provide the last Jenkins core/plugin version where this worked and the first core/plugin version where this started failing.

          Show
          basil Basil Crow added a comment - Hi Queria Sa-Tas , can you please provide detailed steps to reproduce the problem from scratch ? Please also provide the last Jenkins core/plugin version where this worked and the first core/plugin version where this started failing.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            queria Queria Sa-Tas
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: