Skip to main content

Script Engines

Flowable runs scripts in many places: script tasks, listeners, service registry script services, REST service handlers, action bots and the script handlers of the BPMN HTTP task. Scripts are written in JavaScript or Groovy, and a script engine is the component that executes them.

This page mainly describes the engines that Flowable provides for JavaScript, and how to select, install and configure them. Groovy always runs on the Groovy engine, inside the JVM of the application and without isolation. It is disabled by default from 2027.1 and will be removed in 2027.2. Refer to Script languages.

This page covers:

  • Why scripts must be isolated from the application.
  • The available JavaScript engines, and what a script can access on each of them.
  • The default engines and script languages of each Flowable release.
  • The installation and configuration requirements of each engine.

For information on writing scripts, refer to Back End Scripting.

Release overview
  • Before 2026.1.6: Flowable runs JavaScript on Nashorn, without isolation. Refer to Scripts before 2026.1.6.
  • 2026.1.6 and later 2026.1 patches: the GraalJS engines SECURE and COMPAT are available as an opt-in. Nashorn remains the default.
  • 2027.1: SECURE is the default engine and Groovy is disabled by default. Nashorn and Groovy will be removed in 2027.2.

Why script isolation is important​

Scripts are written by modelers in Flowable Design and executed on the server. Without isolation, a script runs inside the Java Virtual Machine (JVM) of the application, with the same permissions as the application itself. Such a script can:

  • Read files on the server, for example configuration files that contain database passwords.
  • Read environment variables, which often contain credentials.
  • Execute operating system commands.
  • Open network connections to other systems in the network.
  • Use any Java class and any Spring bean of the application. This gives the script read and write access to all data in the database, including data that belongs to other tenants, and lets it bypass the permission checks of Flowable.
  • Consume all CPU time or memory of the server. An endless loop or a very large data structure can make the server slow or unavailable for all users.

As a result, anyone who can deploy a model that contains a script effectively controls the server. This is a security risk:

  • The people who build models are often not the people who operate the server.
  • An attacker who gains access to an account that can deploy models can execute code on the server.
  • In a multi-tenant installation, a script of one tenant can access the data of all tenants.
  • A faulty script can make the server unavailable, even without malicious intent.

Modelers often hold elevated permissions in an organization, because they can create and deploy apps, processes and cases, and with them, scripts. Without script isolation, the permission to deploy models is effectively equivalent to access to the server. Review which users and groups hold this permission in your organization, and grant it only where this level of trust is appropriate.

warning

Trusted modelers do not remove the risk

Trust in the modelers protects only against the modelers themselves. When an attacker gains access to the machine or the account of a modeler, for example through stolen credentials or a compromised workstation, the attacker can deploy scripts with the same permissions. Without script isolation, this gives the attacker access to the server, regardless of how trustworthy the modeler is. For this reason, use the isolated SECURE engine even when all modelers are trusted.

Script isolation reduces these risks. An isolated script runs in a separate, restricted environment. It can only use the data and functions that Flowable explicitly provides, and Flowable limits the CPU time and memory that it can consume.

Key terms​

TermMeaning
Script authorThe person who writes a script, usually a modeler in Flowable Design.
Trusted script authorA script author who may have the same level of access as the application itself, for example a developer in your own team.
CallerThe Flowable component that starts a script, for example a script task or a REST service handler.
Caller objectsThe objects that the caller makes available to a script in addition to the flw API, for example flwHttpRequest in a REST service handler.
NashornA JavaScript engine that runs inside the JVM of the application. It was part of the JDK up to and including Java 14. From Java 15, Nashorn is a separate OpenJDK project that must be added as a third-party dependency (org.openjdk.nashorn:nashorn-core). All Flowable releases before 2026.1.6 use Nashorn for JavaScript.
GraalJSThe JavaScript engine of GraalVM. It supports current ECMAScript versions. The SECURE and COMPAT engines are based on GraalJS.
IsolateA separate instance of GraalJS with its own memory and its own garbage collector. Refer to Isolates.

Isolates​

The SECURE engine runs every script in an isolate. An isolate, called a polyglot isolate in GraalVM, is a separate instance of GraalJS with its own memory (heap) and its own garbage collector. It does not share any Java objects with the application.

A script in an isolate has no access to the application. It cannot use Java classes, files, the network, processes, threads or environment variables. It can only access:

  • The flw scripting API.
  • Copies of the caller objects. The script never receives the live objects.

When a script calls a flw method, the isolate forwards the call to the application, which performs the operation and returns the result. This way, every operation that a script performs goes through Flowable.

Isolate processes​

By default, each isolate runs in a separate operating system process, as a child process of the JVM. This is the EXTERNAL isolate mode, and it provides two additional safeguards:

  • If a script crashes its isolate or exhausts its memory, only the isolate process stops. The application keeps running.
  • If a script does not stop when it reaches the CPU time limit, Flowable terminates the isolate process.

The isolates can also run inside the JVM (INTERNAL isolate mode). This mode is faster, but a malicious script can then crash or block the JVM. Refer to Isolate modes.

Isolate pool​

Flowable maintains a pool of isolates, with a maximum of 4 isolates by default. Several scripts can run in the same isolate at the same time:

  • Each script has its own memory limit.
  • All scripts in an isolate share the memory limit of that isolate.
  • If an isolate stops, all scripts that run in it at that moment fail.

The pool size and the limits are configurable. Refer to JavaScript engine limits.

Isolate requirements​

The isolate is a native executable that is shipped with the GraalVM dependencies. As a consequence:

  • Isolates are only available for specific operating systems and processor architectures. Refer to Supported platforms.
  • The isolate requires the GNU C library (glibc). It does not run on Alpine Linux, which uses the musl C library. Refer to Docker images.
  • GraalVM must be able to extract the isolate to a directory and execute it from there. Refer to Running outside the Docker images.
  • The isolates use memory outside the Java heap. Refer to Memory.

Scripts before 2026.1.6​

Releases before 2026.1.6 run JavaScript on Nashorn and Groovy on the Groovy engine. Both engines run inside the JVM of the application.

These releases already provide sandboxing settings that limit what scripts can do:

  • Strict expression mode limits the Spring beans that a script can use to the beans that are allowed in strict mode. The engine services, such as runtimeService and taskService, are not available to scripts.
  • Max transaction duration fails and rolls back a transaction that runs longer than the configured duration. The duration is checked when an engine operation completes, so it does not stop a script that is still running, for example a script with an endless loop.
  • Rate limiting and the other sandboxing settings limit the load that models can generate in general.
  • Disable scripting turns off scripts entirely.

These settings reduce the risk, but they do not isolate scripts from the application. A Nashorn or Groovy script can still use any Java class, and with it access files, the network, processes and environment variables, as described in Why script isolation is important. There is also no limit on the CPU time or memory of a script. On these releases, grant the permission to deploy models only to trusted script authors.

Nashorn is included in the JDK on Java 8 and Java 11. On Java 17, Nashorn is a third-party dependency that must be added to the application. Refer to Adding Nashorn.

To run scripts in isolation, upgrade to 2026.1.6 or later and select the SECURE engine.

The JavaScript engines​

2026.1.6+

The property flowable.sandbox.script.javascript.engine selects the engine that runs JavaScript. Three engines are available:

  • SECURE runs every script in an isolate. This is the recommended engine, including for untrusted script authors and multi-tenant installations. It is the default from 2027.1.
  • COMPAT runs scripts inside the JVM of the application and emulates Nashorn. Use it only for existing Nashorn scripts written by trusted script authors.
  • NASHORN runs scripts on Nashorn, as in earlier releases, without any limits. Use it only as a temporary measure for scripts that cannot be migrated yet.
flowable.sandbox.script.javascript.engine=SECURE

Flowable only creates the selected engine. If that engine cannot run, the application fails to start and logs a message that explains how to resolve the problem. Typical causes are a missing dependency, an unsupported Java version or an isolate that cannot start. Flowable never falls back to an engine without limits.

Engine comparison​

SECURECOMPATNASHORN
Where the script runsIn an isolate, by default in a separate processInside the JVM of the applicationInside the JVM of the application
flw scripting APIYesYesYes
Caller objectsCopiesLive objects, some of them read-onlyLive objects
execution, Spring beans and variables by nameNoYesYes
Java classesNoOnly the types on an allow listAll
Files, network, processes, threads and environment variablesNoNo direct access, but a Spring bean that the script calls can still perform these operationsYes
Reflection and class loadersNoNoYes
CPU time limitYesYes, for the script code onlyNo
Memory limitYesNoNo
Isolated from the applicationYesNoNo
Java version21 or later21 or laterAll supported versions

SECURE​

SECURE runs every script in an isolate. The script can only use the flw API and copies of the caller objects. Flowable limits the CPU time and memory of the script, and the size of the data that the script returns.

SECURE is the recommended engine for all installations. It is the only suitable engine when script authors are not trusted or when several tenants share the installation.

Scripts that use execution, Spring beans or Java classes do not run on SECURE. These scripts must be migrated to the flw API. Refer to Moving scripts from Nashorn.

COMPAT​

COMPAT allows existing Nashorn scripts to run on GraalJS with few or no changes. It is not a security boundary. Use it only when all script authors are trusted.

How COMPAT works​

COMPAT runs GraalJS in Nashorn compatibility mode, inside the JVM of the application. Scripts receive the same objects as on Nashorn: execution, the Spring beans, the variables by name and the caller objects.

Security considerations​

Because the script runs in the same JVM and receives live application objects, it can reach the data and services of the application through these objects. For example, when strict expression mode is disabled, a script can call the runtimeService bean and read or modify other process instances. As on Nashorn, the Spring beans that a script can reach depend on strict expression mode.

Restrictions​

COMPAT blocks direct access to the operating system and to the internals of the JVM. A script on COMPAT cannot:

  • Read or write files, or perform other IO.
  • Start processes or use native code.
  • Start threads.
  • Read environment variables or JVM system properties.
  • Use reflection or class loaders, for example getClass().
  • Use other script engines, for example through javax.script.
  • Change the default locale or time zone of the JVM.
  • Load Java types that are not on the allow list.

Limitations​

  • Only the CPU time limit applies, and only while the script code runs. Long-running Java calls made by the script are not limited. The memory limits do not apply.
  • On a standard JDK, GraalJS runs in interpreter mode, without just-in-time compilation. CPU-intensive scripts can therefore run slower.
  • COMPAT requires Java 21 or later.

Java types on COMPAT​

On COMPAT, scripts can only load the following Java types by name, for example with Java.type:

  • The primitive types, and arrays of allowed types.
  • java.lang.String, StringBuilder, Math, StrictMath, Object, Number and the wrapper types (Integer, Long, Double, Float, Short, Byte, Boolean and Character).
  • All types in java.math, java.time and java.text.
  • The types in java.util, except java.util.concurrent, java.util.jar, java.util.zip, java.util.logging, java.util.prefs, java.util.spi, ServiceLoader, Timer, Scanner, Formatter and ResourceBundle.

All other Java types are blocked, including the Flowable types. To block access to Java types entirely, set flowable.sandbox.script.compat.java-types-enabled=false. The default is true.

NASHORN​

NASHORN is the engine of the releases before 2026.1.6. It provides no isolation and no limits. Refer to Scripts before 2026.1.6. Nashorn is deprecated from 2027.1 and will be removed in 2027.2.

Choosing an engine​

  1. Use SECURE by default. It is required when script authors are not trusted or when several tenants share the installation.
  2. If existing Nashorn scripts do not run on SECURE yet and all script authors are trusted, use COMPAT until the scripts are migrated.
  3. If existing scripts do not run on COMPAT either, use NASHORN temporarily. Migrate the scripts before upgrading to 2027.2.
caution

COMPAT and NASHORN do not isolate scripts from the application. Do not use them when script authors are not trusted or when several tenants share the installation. Even with trusted script authors, a compromised modeler account gives an attacker the same access. Refer to Why script isolation is important. On SECURE, a script that crashes its isolate also causes the other scripts in that isolate to fail.

The limits of SECURE and COMPAT and the related properties are described in Sandboxing.

Defaults per release​

Before 2026.1.62026.1.6 and later 2026.1 patches2027.1
Default JavaScript engineNashornNASHORNSECURE
SECURENot availableOpt-inDefault
COMPATNot availableOpt-inOpt-in
NASHORNOnly available engineDefault, not deprecatedDeprecated, logs a warning at startup
GroovyEnabledEnabledDisabled by default
Script engines provided by the Flowable startersDepends on the version, refer to Adding NashornUnchangedNone, the application adds the engine it selects
Flowable WAR filesRefer to Adding NashornAll engines, and the isolates of all supported platformsAll engines, and the isolates of all supported platforms
Work and Engage Docker imagesAlpineAlpine as before, plus a -debian image for SECUREDebian, based on flowable-jre:25-debian
flw.getInputEvaluates expressionsEvaluates expressions on NASHORN and the other JSR-223 engines, such as Groovy. Reads paths on SECURE and COMPAT.Reads paths on all engines

The following sections describe these changes in detail.

Planned removal

Flowable 2027.2 will no longer include Nashorn and Groovy. Before upgrading to 2027.2:

  1. Migrate JavaScript to SECURE, or to COMPAT if all script authors are trusted.
  2. Rewrite Groovy scripts in JavaScript.

Upgrading from an older release​

2027.1.0+

From 2027.1, SECURE is the default engine and Groovy is disabled. This applies to existing deployments and running instances as well, not only to new deployments.

On SECURE, a script that uses any of the following fails at runtime:

  • execution, Spring beans or services.
  • Variables referenced by name instead of through flw.getInput.
  • Java classes.
  • autoStoreVariables.

A typical error is ReferenceError: execution is not defined. Groovy scripts fail with Groovy scripts are disabled. Failed asynchronous jobs are retried and then moved to the dead letter queue.

We recommend the following approach:

  1. Before the upgrade, identify the scripts in your models that use execution, Spring beans, Java classes, variables by name, autoStoreVariables or Groovy.
  2. On a 2026.1.6 test environment, select SECURE and run these scripts. Update the scripts that fail. Refer to Moving scripts from Nashorn.
  3. If not all scripts can be migrated before the upgrade, set the properties below before the first start on 2027.1.

To keep most existing scripts working, set:

flowable.sandbox.script.javascript.engine=COMPAT
flowable.sandbox.script.groovy.enabled=true

To keep the behavior of earlier releases until Nashorn is removed, set flowable.sandbox.script.javascript.engine=NASHORN. In the long term, migrate the scripts to the flw API on SECURE.

Script languages​

Scripts can be written in:

  • JavaScript: javascript, js, ecmascript, nashorn, graal.js or graaljs. All of these run on the selected JavaScript engine.
  • Groovy: groovy or groovy-static.
  • juel. A script without a language is evaluated as juel. When strict expression mode is enabled, the strict juel engine is used.

From 2027.1:

  • Groovy is disabled by default. To enable it, set flowable.sandbox.script.groovy.enabled=true.
  • Design only offers JavaScript by default. To make Groovy available in Design, set flowable.design.scripting-languages=javascript,groovy.
  • Scripts in a language that is not enabled are rejected, both at deployment and at execution.
  • Other JSR-223 languages, such as Jython, Kotlin or JRuby, are rejected unless flowable.sandbox.script.javascript.engine=NASHORN is set.

In 2026.1, Groovy remains enabled.

Java requirements​

SECURE requires Java 21 or later. GraalVM does not support Java 17, so COMPAT also requires Java 21 or later.

  • 2027.1: an application that runs on Java 17 and does not set flowable.sandbox.script.javascript.engine fails to start. On Java 17, set flowable.sandbox.script.javascript.engine=NASHORN. (COMPAT starts on Java 17 with a warning.)
  • 2026.1.6: Nashorn remains the default, so Java 17 continues to work without changes. To use SECURE or COMPAT, run on Java 21 or later.

Refer to System Requirements for the supported Java versions of each Flowable version.

Supported platforms​

Isolates for SECURE are available for:

  • Linux amd64 and aarch64
  • macOS aarch64
  • Windows amd64

No isolate is available for macOS on Intel processors. On that platform, use COMPAT or NASHORN.

Contents of the Flowable WAR files​

The WAR files of Flowable Work, Flowable Engage and Flowable Work Chat contain the isolates of all supported platforms, so the same WAR file runs on every supported platform. The isolates increase the size of these WAR files.

  • 2027.1: the WAR files contain all engines (SECURE, COMPAT, Nashorn and Groovy). No additional dependencies are required.
  • 2026.1.6: the WAR files also contain all engines (SECURE, COMPAT, Nashorn and Groovy). No additional dependencies are required to use SECURE or COMPAT.

Running outside the Docker images​

To run a WAR file or a custom application with SECURE outside the Flowable Docker images:

  1. Make sure that the GraalVM resource cache is writable and allows executing programs. GraalVM extracts the isolate to this directory. The directory is set with polyglot.engine.userResourceCache and defaults to a location in the home directory of the user.
  2. Make sure that java.io.tmpdir is writable. The isolates use Unix domain sockets in this directory.
  3. If step 1 is not possible, extract the resources in advance and start the JVM with -Dpolyglot.engine.resourcePath=<directory>.
  4. Set ulimit -c 0. This prevents a crashed isolate from writing a core dump that contains script data.
  5. Run only one application per JVM. Refer to the warning below.
  6. Plan for the memory of the isolates. Refer to Memory.
warning

One application per JVM

The isolate processes of SECURE assume one application per JVM. When several applications share a JVM, for example several WAR files in one servlet container, they can stop each other's isolates while Flowable initializes the engines. Scripts that run at that moment fail, and Flowable then rebuilds the engines.

Custom builds based on the starters​

From 2027.1, the Flowable modules and starters, including flowable-spring-boot-starter-platform, no longer include a script engine. An application built on the starters must add the dependencies of the engine it selects. The versions are managed by the Flowable BOM.

EngineDependencies to add
SECUREorg.graalvm.polyglot:js-isolate-community (type pom), which includes the isolates of all four platforms. For a production build, use org.graalvm.polyglot:polyglot together with the org.graalvm.polyglot:js-isolate-<os>-<arch>-community artifact (type pom) of the target platform.
COMPATorg.graalvm.polyglot:js-community (type pom)
NASHORNorg.openjdk.nashorn:nashorn-core
Groovyorg.apache.groovy:groovy-jsr223, and org.flowable:flowable-groovy-script-static-engine for groovy-static

For example, SECURE for a production build that runs on Linux amd64:

<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>polyglot</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>js-isolate-linux-amd64-community</artifactId>
<type>pom</type>
</dependency>

The platform-specific artifacts are js-isolate-linux-amd64-community, js-isolate-linux-aarch64-community, js-isolate-darwin-aarch64-community and js-isolate-windows-amd64-community.

COMPAT:

<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>js-community</artifactId>
<type>pom</type>
</dependency>

If the selected engine is missing, the application fails to start with a message such as:

The SECURE JavaScript engine is selected but cannot run: org.graalvm.polyglot is not on the class path.

The message also lists the dependencies to add and the alternative configuration options.

Groovy fails in the same way when flowable.sandbox.script.groovy.enabled=true is set and Groovy is not on the class path.

In 2026.1, the starters continue to include their script engines. To use SECURE or COMPAT in a custom 2026.1 build, add the GraalVM dependencies from the table above. If they are missing, the application fails to start with the same message.

Docker images​

The isolate requires glibc, so SECURE requires a Work or Engage image based on Debian instead of Alpine. COMPAT runs inside the JVM of the application without an isolate, so it also runs on the Alpine images.

  • 2027.1 and later: the Work and Engage images are based on flowable-jre:25-debian (Azul Zulu 25 JRE) and run SECURE without additional configuration. The other Flowable images remain on Alpine.
  • 2026.1.6: the Work and Engage images remain on Alpine and are unchanged (for example flowable/flowable-work:2026.1.6). They run Nashorn and Groovy as before, and COMPAT as an opt-in. The Alpine images do not contain the isolates. Selecting SECURE on an Alpine image causes a startup failure with a message that SECURE requires a glibc-based Linux.
  • 2026.1.6 with SECURE: use the Debian image of the same version, which has the -debian tag suffix, for example flowable/flowable-work:2026.1.6-debian or flowable/flowable-work:2026.1-debian. It is based on flowable-jre:21-debian (Azul Zulu 21 JRE) and built from the same WAR file.

Each architecture of a Debian image (linux/amd64, linux/arm64) contains only the isolate of that architecture. The isolate is extracted into /flowable-graal-resources when the image is built, and nothing is extracted into /tmp at startup. The images can therefore run with a read-only root file system and a noexec /tmp. /tmp must remain writable, because the isolates use Unix domain sockets in java.io.tmpdir.

When extending a Debian-based Work or Engage image:

  • Install packages with apt-get instead of apk.
  • Use the glibc builds of native libraries, not the musl builds.
  • The user and group ID (10001) are unchanged.
  • An image with a custom entrypoint must pass -Dpolyglot.engine.resourcePath=/flowable-graal-resources to the JVM. It should also run ulimit -c 0, as the Flowable entrypoint does, so that a crashed isolate does not write script data to disk. The Flowable entrypoint reads the resource path from FLOWABLE_GRAAL_RESOURCE_PATH when it is set.
  • Increase the container memory limit to account for the isolates. Refer to Memory. The images start the JVM with -Xmx1024M.

Moving scripts from Nashorn​

The differences between Nashorn and the SECURE and COMPAT engines mainly affect script authors. They are described in Back End Scripting.

Adding Nashorn​

Nashorn was removed from the JDK in Java 15. Since then, it is a separate OpenJDK project that is available as the third-party dependency org.openjdk.nashorn:nashorn-core. It must be added when NASHORN is selected and the application does not include it.

The Flowable WAR files of 2026.1 and 2027.1 include Nashorn. In 2026.1, flowable-spring-boot-starter-platform also includes it.

Custom build​

From 2027.1, a custom build that selects NASHORN must add the dependency itself. The version is managed by the Flowable BOM:

<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
</dependency>

WAR file without Nashorn​

Some WAR files do not include Nashorn, for example those of older versions that run on Java 17. For these WAR files, add Nashorn and its dependencies to the class path of the servlet container:

  1. Download nashorn-core from Maven Central.
  2. Download the ASM libraries that nashorn-core depends on, in the version specified in its pom.xml: asm, asm-commons, asm-tree and asm-util.
  3. Copy the five JAR files into the lib folder of Apache Tomcat.
  4. Restart Tomcat.