Nashorn to GraalVM Migration#458
Open
kevin-mcgoldrick wants to merge 6 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the JavaScript engine from Nashorn (
org.openjdk.nashorn:nashorn-core:15.7) to GraalVM JS (org.graalvm.polyglot:*:25.0.2). Nashorn was removed from the JDK in Java 15 and the standalone Nashorn project has limited maintenance; GraalVM JS is the actively maintained successor with better ECMAScript compliance and performance.What changed
New factory class —
JsEngineFactory(tools/script_engine):JsEngineFactory.createJsEngine()GraalJSScriptEnginewith restricted host access — onlycom.intuit.tank.script.models.*andjava.util.*are accessible from user scripts, blocking dangerous classes likeRuntimeandProcessBuilderjs.nashorn-compatmode so existing scripts usingload("nashorn:mozilla_compat.js")andimportPackage()continue to workCallers updated (3 files):
LogicRunner.java— agent harness logic step executionExternalScript.java— external script filter engine resolution (.jsextension → GraalVM, other extensions → ScriptEngineManager fallback)LogicStepEditor.java— web UI script testingConfiguredLanguage engine factory references (2 files):
tools/agent_debuggerandtools/script_filter— updated factory class name from Nashorn/Rhino toGraalJSScriptEngineFactoryDependency changes (9 pom.xml files):
org.openjdk.nashorn:nashorn-corewith three GraalVM artifacts:org.graalvm.polyglot:polyglot,org.graalvm.polyglot:js-community(pom, runtime),org.graalvm.js:js-scriptenginescript-enginedependency todata_model(forJsEngineFactoryinExternalScript)25.0.2Tests — new
ScriptRunnerTest(11 tests) intools/script_engine:Runtime/ProcessBuilder/File/URLblocked)scriptFilter.jsthat usesnashorn:mozilla_compat.jsandimportPackage()to confirm backward compatibilityImpact
nashorn-compatmode preserves existing script behaviorTest plan
ScriptRunnerTest— 11 tests verifying GraalVM JS engine, script execution, and security restrictionsimportPackage(com.intuit.tank.script.models)continue to work.jsextension run correctly🤖 Generated with Claude Code