|
@@ -26,6 +26,7 @@ import java.util.stream.Collectors; |
|
|
import javax.script.Bindings; |
|
|
import javax.script.Bindings; |
|
|
import javax.script.Compilable; |
|
|
import javax.script.Compilable; |
|
|
import javax.script.CompiledScript; |
|
|
import javax.script.CompiledScript; |
|
|
|
|
|
import javax.script.ScriptContext; |
|
|
import javax.script.ScriptEngine; |
|
|
import javax.script.ScriptEngine; |
|
|
import javax.script.ScriptEngineManager; |
|
|
import javax.script.ScriptEngineManager; |
|
|
import javax.script.SimpleBindings; |
|
|
import javax.script.SimpleBindings; |
|
@@ -191,12 +192,22 @@ public class JavaxScriptRunner extends ScriptRunnerBase { |
|
|
} |
|
|
} |
|
|
ScriptEngine result = |
|
|
ScriptEngine result = |
|
|
new ScriptEngineManager().getEngineByName(getLanguage()); |
|
|
new ScriptEngineManager().getEngineByName(getLanguage()); |
|
|
|
|
|
maybeApplyGraalJsProperties(result); |
|
|
if (result != null && getKeepEngine()) { |
|
|
if (result != null && getKeepEngine()) { |
|
|
this.keptEngine = result; |
|
|
this.keptEngine = result; |
|
|
} |
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static final String DROP_GRAAL_SECURITY_RESTRICTIONS = "polyglot.js.allowAllAccess"; |
|
|
|
|
|
|
|
|
|
|
|
private void maybeApplyGraalJsProperties(final ScriptEngine engine) { |
|
|
|
|
|
if (engine != null && engine.getClass().getName().contains("Graal")) { |
|
|
|
|
|
engine.getBindings(ScriptContext.ENGINE_SCOPE) |
|
|
|
|
|
.put(DROP_GRAAL_SECURITY_RESTRICTIONS, true); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Traverse a Throwable's cause(s) and return the BuildException |
|
|
* Traverse a Throwable's cause(s) and return the BuildException |
|
|
* most deeply nested into it - if any. |
|
|
* most deeply nested into it - if any. |
|
|