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

Sandbox Rejected Access Exception when using groovy.text.TemplateEngine createTemplate String

XMLWordPrintable

      org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.text.TemplateEngine createTemplate java.lang.String
      That method is overloaded. The version that accepts a File argument works (after approval), but the version that accepts a String argument does not.

      To reproduce, put the following in a new pipeline project:

      def engine = new groovy.text.GStringTemplateEngine();
      engine.createTemplate(new File('/etc/hostname')); // This works, after script approval
      engine.createTemplate(''); // This fails
      

      If the exact same code is put in the Jenkins script console, it runs fine.

            jglick Jesse Glick
            polson136 Peter Olson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: