Class SandboxScript

java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Script
com.axelor.script.SandboxScript
All Implemented Interfaces:
SandboxCode, groovy.lang.GroovyObject

public abstract class SandboxScript extends groovy.lang.Script implements SandboxCode
Base class of the scripts and templates compiled by GroovyScriptSupport.

Script methods that compile and run other code do so in a fresh GroovyShell without the policy's compilation customizers, which would escape the sandbox. They are overridden here to throw, so they are denied however they are dispatched (direct call, dynamic method name, invokeMethod, closure delegation...).

This class also marks sandboxed code, see GroovySandbox.denyFromSandbox(String).

  • Constructor Details

    • SandboxScript

      protected SandboxScript()
    • SandboxScript

      protected SandboxScript(groovy.lang.Binding binding)
  • Method Details

    • evaluate

      public Object evaluate(String expression)
      Overrides:
      evaluate in class groovy.lang.Script
    • evaluate

      public Object evaluate(File file)
      Overrides:
      evaluate in class groovy.lang.Script
    • run

      public void run(File file, String[] arguments)
      Overrides:
      run in class groovy.lang.Script