Permissions

Ende runs code in a secure sandbox: a program has no access to sensitive system I/O unless you grant it. This page is the reference for every permission and the --allow-* / --deny-* flags that control it. For the security model behind it and guidance on running untrusted code, see Security.

By default, access to most system I/O is denied. There are some I/O operations that are allowed in a limited capacity, even by default. These are described below.

To enable these operations, the user must explicitly grant permission to the Ende runtime. This is done by passing the --allow-read, --allow-write, --allow-net, --allow-env, --allow-run, --allow-sys, --allow-ffi, and --allow-import flags to the ende command.

During execution of a script, a user can also explicitly grant permission to specific files, directories, network addresses, environment variables, and subprocesses when prompted by the runtime. Prompts are shown only when stdin and stderr are both a TTY (stdout doesn't matter), and not when the --no-prompt flag is passed to the ende command or ENDE_NO_PROMPT is set; then the request is denied. At a prompt, Ctrl-D denies the request. With TERM=dumb the prompt is printed as plain lines that aren't redrawn (Ende 2026.12.01+). See Security for what a prompt looks like.

Users can also explicitly disallow access to specific resources by using the --deny-read, --deny-write, --deny-net, --deny-env, --deny-run, --deny-sys, --deny-ffi, and --deny-import flags. These flags take precedence over the allow flags. For example, if you allow network access but deny access to a specific domain, the deny flag will take precedence.

Ende also provides a --allow-all flag that grants all permissions to the script. This disables the security sandbox entirely, and should be used with caution: with --allow-all, the script has full access to the system.

Definition: -A, --allow-all

ende run -A script.ts
ende run --allow-all script.ts

-A applies to your app's own code. It doesn't widen code that runs with its own permissions (Ende 2026.12.01+):

  • A dependency sandboxed with isolate in ende.json still gets only what its rule grants. A rule with "permissions": [] gets nothing, even under -A.
  • An extension gets only what its ende.json entry and its manifest both allow.
  • When ende.json declares extensions, the app can't write the config file, the lockfile, the vendor folder or a local extension's folder, even with -A. Edit them outside the app, then run ende install.

Under -A, an extension declared with "permissions": [] that reads a file, and the app writing its lockfile, both throw NotCapable:

@acme/plug: Requires read access to "secret.txt". Grant it in ende.json under extensions["@acme/plug"].permissions.read (the extension's manifest must ask for it too)
Requires write access to "ende.lock", which pins this app's extensions. Run `ende install` to change it

These are checks inside the Ende process. A subprocess started with --allow-run and native code loaded with --allow-ffi, both part of -A, can still change those files. The next run refuses a changed grant or changed code for an extension the lockfile already records, unless the lockfile was changed to match. Other edits aren't caught: a newly declared extension is recorded on its first run, and the app's own permissions in ende.json aren't pinned.

By default, Ende will not generate a stack trace for permission requests as it comes with a hit to performance. Users can enable stack traces with the ENDE_TRACE_PERMISSIONS environment variable to 1.

Ende can also generate an audit log of all accessed permissions, regardless of whether the access was allowed or denied.

Set ENDE_AUDIT_PERMISSIONS to a file path to write JSONL — each line is an object with the following keys:

  • v: the version of the format
  • datetime: when the permission was accessed, in RFC 3339 format
  • permission: the name of the permission
  • value: the value that the permission was accessed with, or null if it was accessed with no value

A schema for this can be found in permission-audit.v1.json.

In addition, this env var can be combined with the above-mentioned ENDE_TRACE_PERMISSIONS, which then adds a new stack field to the entries which is an array containing all the stack trace frames.

You can also set ENDE_AUDIT_PERMISSIONS=otel to emit each access as an OpenTelemetry log record instead of writing to a file. The records are sent to whichever exporter you have configured via OTEL_ENDE and carry these attributes:

  • ende.permission.type
  • ende.permission.value
  • ende.permission.stack (if ENDE_TRACE_PERMISSIONS is also set)

This is the recommended setup if you already collect OpenTelemetry data — the permission audit lands next to your traces and metrics so you can correlate it with request handling.

OTEL_ENDE=true ENDE_AUDIT_PERMISSIONS=otel ende run -A main.ts

Configuration file

Ende supports storing permissions in the ende.json/ende.jsonc file. Read more under configuration.

File system access

By default, executing code can not read or write arbitrary files on the file system. This includes listing the contents of directories, checking for the existence of a given file, and opening or connecting to Unix sockets.

Access to read files is granted using the --allow-read (or -R) flag, and access to write files is granted using the --allow-write (or -W) flag. These flags can be specified with a list of paths to allow access to specific files or directories and any subdirectories in them.

Definition: --allow-read[=<PATH>...] or -R[=<PATH>...]

PATHs may be separated by comma (,) characters. To include a comma character in the PATH, it must be doubled. (Example: this file,, contains a comma.txt)

# Allow all reads from file system
ende run -R script.ts
# or 
ende run --allow-read script.ts

# Allow reads from file foo.txt and bar.txt only
ende run --allow-read=foo.txt,bar.txt script.ts

# Allow reads from any file in any subdirectory of ./data
ende run --allow-read=data script.ts

Definition: --deny-read[=<PATH>...]

# Allow reading files in /etc but disallow reading /etc/hosts
ende run --allow-read=/etc --deny-read=/etc/hosts script.ts

# Deny all read access to disk, disabling permission prompts for reads.
ende run --deny-read script.ts

Definition: --allow-write[=<PATH>...] or -W[=<PATH>...]

# Allow all writes to file system
ende run -W script.ts
# or 
ende run --allow-write script.ts

# Allow writes to file foo.txt and bar.txt only
ende run --allow-write=foo.txt,bar.txt script.ts

Definition: --deny-write[=<PATH>...]

# Allow reading files in current working directory 
# but disallow writing to ./secrets directory.
ende run --allow-write=./ --deny-write=./secrets script.ts

# Deny all write access to disk, disabling permission prompts.
ende run --deny-write script.ts

Renaming or removing a directory moves or deletes everything inside it, so both need write access to the whole directory. A --deny-write rule for any path inside it denies the operation. With --allow-write --deny-write=data/d/secret, Ende.rename("data/d", "data/d2") throws NotCapable: Requires write access to "data/d" and everything inside it, but a path inside it is denied, while renaming a file elsewhere in data/d still works.

A rename also needs read access to everything inside the old path (Ende NEXT_RELEASE+), or it would move denied files to a path you can read. A --deny-read or --ignore-read rule for any path inside a directory denies renaming it. With --allow-read --allow-write --deny-read=data/d/secret, the same call throws NotCapable: Requires read access to "data/d" and everything inside it, but a path inside it is denied.

Ende.copyFile copies only files. A source that isn't a regular file, such as a directory, throws a TypeError on every platform (Ende NEXT_RELEASE+).

Ende 2026.12.01

Ende.rename used to check only the old path itself, so renaming a directory could move a denied path out from under its rule. Upstream Deno still does.

Ende NEXT_RELEASE

Earlier releases checked read access only for the old path itself, so renaming a directory with read and write access to it moved the --deny-read paths inside it somewhere readable. On macOS, Ende.copyFile could copy a whole directory, denied files included. The refusal for a --deny-write path inside the directory also ended in "run again with the --allow-write flag", although the flag was usually set already.

Some APIs in Ende are implemented using file system operations under the hood, even though they do not provide direct read/write access to specific files. These APIs read and write to disk but do not require any explicit read/write permissions. Some examples of these APIs are:

  • localStorage
  • caches
  • Blob

Because these APIs are implemented using file system operations, users can use them to consume file system resources like storage space, even if they do not have direct access to the file system.

During module loading, Ende can load files from disk. This sometimes requires explicit permissions, and sometimes is allowed by default:

  • All files that are imported from the entrypoint module in a way that they can be statically analyzed are allowed to be read by default. This includes static import statements and dynamic import() calls where the argument is a string literal that points to a specific file or a directory of files. The full list of files that are in this list can be printed using ende info <entrypoint>. This covers only files inside the project folder: importing a local file from outside it needs read access (Ende NEXT_RELEASE+). See Imports from outside the project folder.
  • A --deny-read=<path> rule refuses every import of that path, static or dynamic, code or data (Ende NEXT_RELEASE+). So do --ignore-read=<path> and a refused prompt for the path. A bare --deny-read, with no path, doesn't block imports from inside the project folder, code or data. Imports from outside it are refused, since they need read access.
  • Files that are dynamically imported in a way that can not be statically analyzed require runtime read permissions.
  • A Web Worker's script is loaded as if it were a dynamic import, so a worker whose script is a local file, such as new Worker(new URL("./worker.ts", import.meta.url).href, { type: "module" }), requires --allow-read. This applies to the worker's entry script and its entire static import graph, and the read access is checked against the permissions of the thread that created the worker. A worker loaded from an https: URL instead requires --allow-import; data: and blob: URLs need no permission.
  • The http: and https: modules that a worker's script imports statically are checked against the worker's own import permission, which the ende.permissions option of new Worker() can narrow with --unstable-worker-options (Ende 2026.11.06+). A worker created with import: false can't run a remote module it imports statically, even when the thread that created it has --allow-import.
  • An extension's static graph is loaded with its own limits, not the app's (Ende 2026.12.01+). A local extension's imports may read only its own folder, with symlinks resolved, and a remote or jsr: extension's imports can't read local files. Importing a file outside that folder fails to load, even under -A: Extension "@acme/plug": Requires read access to ".../util.ts".
  • A dependency sandboxed with isolate loads local files outside its own folder, code or data, with its own read permission (Ende 2026.12.01+). A sandbox granted "permissions": [] that imports one of the app's modules fails: ./vendor/pkg/: Requires read access to ".../util.ts"; grant it in ende.json under isolate["./vendor/pkg/"].permissions.read. Remote modules in its graph load as usual.

When fetching modules from the network, or when transpiling code from TypeScript to JavaScript, Ende uses the file system as a cache. This means that file system resources like storage space can be consumed by Ende even if the user has not explicitly granted read/write permissions.

Imports from outside the project folder

Ende NEXT_RELEASE

Earlier releases loaded any local file in the static module graph without flags, wherever it was. Imported as text, bytes or JSON, that hands the program the whole file. Upstream Deno still does.

Any import of a local file outside the project folder needs read access for that path: code or data (JavaScript, TypeScript, Wasm, JSON, text, bytes or CSS), static or dynamic. Ende checks it before reading the file:

error: Requires read access to "/work/repo/shared/util.ts", which is imported from outside the project folder "/work/repo/app". Run again with --allow-read=/work/repo/shared/util.ts, or put an ende.json in a folder that holds both
    at file:///work/repo/app/main.ts:1:24

The message says is imported as text (or as JSON, as bytes) for data. The hint about ende.json is left out when the only folder that holds both is one that can't be a project folder.

The project folder is:

  • the folder of the root ende.json, when it holds the entry point;
  • otherwise, the entry point's folder. The entry point is the main module for ende run, ende serve, ende compile and ende desktop, and the current folder for ende eval, ende repl, code read from stdin, ende test and ende bench.

Workspace members and links inside the project folder count as part of it. links and import map paths outside it don't widen it. Paths are compared with symlinks resolved, so a symlink inside the project folder that points outside it is outside. /, the home folder and any folder that holds the home folder never count: with one of them as the project folder, every local import other than the entry point needs --allow-read.

Files named on the command line are entry points and need no flag wherever they are: the main module, --preload files, and the files passed to ende test or ende bench. Their own imports are checked as usual. Files the config adds through test.include or bench.include from outside the project folder need --allow-read.

Commands that read code without running it don't check these imports: ende check, ende cache, ende info, ende doc, ende lint, ende publish and ende vendor. Lint plugins, which ende lint does run, have no read access at all and load local code only from the project folder. See Permissions in the lint plugins guide. ende compile and ende desktop embed a file from outside the project folder only when the --allow-read they're given covers it.

In a monorepo where an app imports a shared folder next to it, put an ende.json in the folder that holds both, or grant --allow-read for the shared folder:

ende run --allow-read=../shared main.ts

A remote module can't import local files at all, as before.

Source lines in error messages

Ende NEXT_RELEASE

Earlier releases read any local file a source map named, with no permission, to show a line of it under an uncaught error. A map could print a line of a file such as ~/.ssh/config to stderr. Upstream Deno still does.

An uncaught error shows the line of source it points at. A source map can point it at another file, so Ende reads a file a source map names, or a separate .map file, only if the program could read it itself: with read access for that path, or, under ende run, inside the project folder. Modules the program loaded are always shown. Extensions and sandboxed dependencies don't get the project folder: they need read access. Ende never prompts for this.

Otherwise the stack trace still points at the original file and position, but the line is left out:

error: Uncaught (in promise) Error: boom
    at file:///work/repo/src/main.ts:2:1

When the .map file itself can't be read, the trace points at the file that ran.

If you transpile into dist/ with separate source maps that point at ../src, and run dist/main.js, keep an ende.json in the folder that holds both, so the sources are in the project folder, or grant --allow-read for them.

A compiled binary or desktop app shows lines from the files embedded in it. A file on disk needs the read access the binary was compiled with.

Watching the file system

Ende NEXT_RELEASE

Earlier releases reported every path under a watched folder, so a recursive watch on a parent folder showed the names of the files in a denied folder inside it, and when they changed. Upstream Deno still does.

Ende.watchFs reports a path only if the program may read it. A path under a --deny-read or --ignore-read rule, or whose read access the program revoked with Ende.permissions.revoke, is left out of an event's paths, and an event with no paths left isn't reported. A rename that moves a file out of a denied folder names only where it went.

With --allow-read=. --deny-read=./data/secret, a recursive watch on data reports changes in data/public but nothing from data/secret.

Revoking read access to a folder also revokes a broader grant that holds it. If the program was run with --allow-read=. and revokes data/secret, the watch stops reporting the rest of . too, except paths with a grant of their own.

When reading or writing through a symbolic link, Ende checks permissions based on the symlink's location, not the target it points to. This means if you have --allow-read=/app, you can read through a symlink at /app/link even if it points to a file outside /app.

Deny rules are matched both ways: as written, and with symlinks resolved on both the rule and the path being accessed (Ende 2026.12.01+). Given a symlink link that points to real, --deny-read=link also denies reading real/secret.txt, and --deny-read=real also denies reading link/secret.txt. The same holds for --deny-write and for deny rules in ende.json. Allow rules are still matched only as written.

$ ende run --allow-read --deny-read=link main.ts   # main.ts reads real/secret.txt
error: Uncaught (in promise) NotCapable: Requires read access to "real/secret.txt", run again with the --allow-read flag

This also covers symlinks you didn't create. On macOS, /var and /tmp are symlinks into /private, so a rule written with one spelling now holds for a path written with the other.

However, Ende prevents privilege escalation through symlinks. If a symlink resolves to a sensitive system path, additional permissions are required:

  • /proc, /dev, /sys (Linux): Reading or writing through symlinks that resolve to these paths requires --allow-all, as these paths can expose sensitive system information.
  • /proc/**/environ: Requires --allow-env since it exposes environment variables.
  • /dev/null, /dev/zero, /dev/random, /dev/urandom: These safe device files are always accessible without additional permissions.

Creating symlinks with Ende.symlink() requires both --allow-read and --allow-write with full access (not path-specific), because symlinks can point to arbitrary locations.

Note: Symlinks that already exist on the filesystem can be read through using the permissions for the symlink's location. The full read/write permission requirement only applies to creating new symlinks with Ende.symlink().

Roots

Ende 2026.12.01

Ende.openRoot is new and unstable. It needs --unstable-fs or "unstable": ["fs"] in ende.json.

Ende.openRoot(path, { read, write }) opens a directory as an Ende.Root. The root's methods (readTextFile, writeTextFile, open, mkdir, rename and so on) take names relative to that directory, and the names can't lead out of it. Use a root when a file name comes from input you don't control. See the example.

A root never gives the code that opened it more access than it already has:

  • Opening a root needs --allow-read for its directory (unless you pass read: false), and --allow-write too with write: true. Without them openRoot throws NotCapable, like any other file system call.
  • Every call through the root is checked again against where it really lands. --deny-read and --deny-write rules for paths inside the root still apply, and so does Ende.permissions.revoke. A name is checked before it is looked up, so a denied name fails the same way whether or not it exists.
  • A root opened without write: true refuses writes, even when the program has write access: NotCapable: Ende.Root.writeFile() needs a root opened with { write: true }; pass it to Ende.openRoot().
  • Renaming a directory under a root needs write access to everything inside it, and read access too (Ende NEXT_RELEASE+), as with Ende.rename.

A name that would resolve outside the root throws Ende.errors.PathEscape, a separate error from NotCapable:

  • an absolute name, such as /etc/passwd;
  • .. that climbs above the root;
  • a symlink that points outside the root, including any symlink with an absolute target;
  • on Windows, a reserved device name such as NUL or COM1, or an NTFS stream name such as a:b.
PathEscape: path ../secret.txt escapes from its root

.. and symlinks are fine while they stay inside. One exception is stricter than Go's os.Root: a name that climbs above the root as written is refused even when a symlink would bring it back inside. If link points to sub/deep, link/../../a.txt throws PathEscape, while sub/deep/../../a.txt works.

Calls that create, open for writing, rename or remove don't follow a final symlink, even one that stays inside the root. They act on the link itself, or fail. To write through a link, open its target.

A root doesn't cover:

  • a mount point or bind mount inside the root, which is followed like any other directory;
  • a hard link inside the root to a file outside it, which is read like any other file, and writing to it changes the file outside;
  • files embedded in a binary built with ende compile: openRoot on one of them throws NotSupported.

A root passed to an extension gives it no access of its own: the extension's permissions apply to every call. A root passed into a sandboxed dependency lets it use the app's access to that directory. A write root over the project folder, the app's code or its config isn't passed into a sandbox:

NotCapable: isolate["./vendor/pkg/"] may write /home/me/app through the Ende.Root it is passed, which is the folder that holds ende.json, or above it. A sandbox could then rewrite the app; pass it a root on only the folders it writes, like "./out", or a read-only root

Network access

By default, executing code can not make network requests, open network listeners or perform DNS resolution. This includes making HTTP requests, opening TCP/UDP sockets, and listening for incoming connections on TCP or UDP.

Network access is granted using the --allow-net flag. This flag can be specified with a list of hosts to allow access to specific network addresses. A host can be a hostname or IP address, optionally with a port.

Hostnames do not allow subdomains, unless explicitly listed. To allow any subdomain for a hostname, * can be used as wildcard for any subdomain.

Definition: --allow-net[=<HOST>...] or -N[=<HOST>...]

# Allow network access
ende run -N script.ts
# or
ende run --allow-net script.ts

# Allow network access to github.com and jsr.io
ende run --allow-net=github.com,jsr.io script.ts

# Allow all subdomains for example.com
ende run --allow-net="*.example.com" script.ts

# A hostname at port 80:
ende run --allow-net=example.com:80 script.ts

# An IPv4 address on port 443
ende run --allow-net=1.1.1.1:443 script.ts

# An IPv6 address, all ports allowed
ende run --allow-net=[2606:4700:4700::1111] script.ts

Definition: --deny-net[=<HOST>...]

# Allow access to network, but deny access 
# to github.com and jsr.io
ende run --allow-net --deny-net=github.com,jsr.io script.ts

# Deny all network access, disabling permission prompts.
ende run --deny-net script.ts

# Deny connections to private IPv4 ranges
ende run --allow-net --deny-net=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 script.ts

--deny-net is checked against the address a connection actually goes to, after DNS resolution, so a hostname that resolves to a denied address is refused. That check runs for every connection, including redirects, so a DNS server that changes its answer between your own lookup and the request can't get around it. Denied IP addresses and CIDR subnets apply to fetch, WebSocket and Ende.connect.

--deny-net applies to the whole program. To block addresses for one HTTP client only, such as one that sends webhooks to user-supplied URLs, pass denyAddresses to Ende.createHttpClient:

const client = Ende.createHttpClient({
  denyAddresses: ["10.0.0.0/8", "127.0.0.0/8", "::1", "fc00::/7"]
});

// Rejects with a TypeError if hook.example.com resolves to a denied address
await fetch("https://hook.example.com/", { client });

Entries are IP addresses or CIDR subnets; IPv4-mapped IPv6 addresses such as ::ffff:10.0.0.1 match IPv4 rules. The client's own proxy is exempt from the list. Through a proxy, only the addresses the destination resolves to locally are checked, because the proxy does its own lookup.

During module loading, Ende can load modules from the network. By default Ende allows loading modules from the following locations using both static and dynamic imports, without requiring explicit network access:

  • https://jsr.io/
  • https://esm.sh/
  • https://raw.esm.sh/
  • https://cdn.jsdelivr.net/
  • https://raw.githubusercontent.com/
  • https://gist.githubusercontent.com/

These locations are trusted "public good" registries that are not expected to enable data exfiltration through URL paths. You can add more trusted registries using the --allow-import flag.

Ende also sends requests to https://dl.ende.sh/ at most once a day to check for updates to the Ende CLI. This can be disabled using ENDE_NO_UPDATE_CHECK=1 environment var.

Environment variables

By default, executing code can not read or write environment variables. This includes reading environment variables, and setting new values.

Access to environment variables is granted using the --allow-env flag. This flag can be specified with a list of environment variables to allow access to specific environment variables. You can now specify suffix wildcards to allow “scoped” access to environmental variables.

Definition: --allow-env[=<VARIABLE_NAME>...] or -E[=<VARIABLE_NAME>...]

# Allow access to all environment variables
ende run -E script.ts
# or
ende run --allow-env script.ts

# Allow HOME and FOO environment variables
ende run --allow-env=HOME,FOO script.ts

# Allow access to all environment variables starting with AWS_
ende run --allow-env="AWS_*" script.ts

Definition: --deny-env[=<VARIABLE_NAME>...]

# Allow all environment variables except 
# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
ende run \
  --allow-env \
  --deny-env=AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY \
  script.ts

# Deny all access to env variables, disabling permission prompts.
ende run --deny-env script.ts

The --ignore-env flag is similar to --deny-env, but instead of denying access outright, it silently returns undefined for any env variable reads. This is useful when you want code to run without failing on missing permissions, treating restricted variables as simply unset.

Definition: --ignore-env[=<VARIABLE_NAME>...]

# Ignore all environment variable reads (returns undefined).
ende run --ignore-env script.ts

# Ignore specific environment variables.
ende run --ignore-env=PORT,HOME script.ts

Note for Windows users: environment variables are case insensitive on Windows, so Ende also matches them case insensitively (on Windows only).

Ende reads certain environment variables on startup, such as ENDE_DIR and NO_COLOR (see the full list).

The value of the NO_COLOR environment variable is visible to all code running in the Ende runtime, regardless of whether the code has been granted permission to read environment variables.

System Information

By default, executing code can not access system information, such as the operating system release, system uptime, load average, network interfaces, and system memory information.

Access to system information is granted using the --allow-sys flag. This flag can be specified with a list of allowed interfaces from the list defined in Ende.SysPermissionDescriptor. These strings map to functions in the Ende namespace that provide OS info, like Ende.systemMemoryInfo.

Definition: --allow-sys[=<API_NAME>...] or -S[=<API_NAME>...]

# Allow all system information APIs
ende run -S script.ts
# or
ende run --allow-sys script.ts

# Allow systemMemoryInfo and osRelease APIs
ende run --allow-sys="systemMemoryInfo,osRelease" script.ts

Definition: --deny-sys[=<API_NAME>...]

# Allow accessing all system information but "networkInterfaces"
ende run --allow-sys --deny-sys="networkInterfaces" script.ts

# Deny all access to system information, disabling permission prompts.
ende run --deny-sys script.ts

The interface names accepted by --allow-sys correspond to the functions in the Ende namespace that expose host information, such as hostname, osRelease, osUptime, loadavg, networkInterfaces, systemMemoryInfo, uid, gid, username, cpus, and homedir. See Ende.SysPermissionDescriptor for the full set of recognized names.

Subprocesses

Code executing inside of an Ende runtime can not spawn subprocesses by default, as this would constitute a violation of the principle that code can not escalate its privileges without user consent.

Ende provides a mechanism for executing subprocesses, but this requires explicit permission from the user. This is done using the --allow-run flag.

Any subprocesses you spawn from your program run independently from the permissions granted to the parent process. This means the child processes can access system resources regardless of the permissions you granted to the Ende process that spawned it. This is often referred to as privilege escalation.

Because of this, make sure you carefully consider if you want to grant a program --allow-run access: it essentially invalidates the Ende security sandbox. If you really need to spawn a specific executable, you can reduce the risk by limiting which programs an Ende process can start by passing specific executable names to the --allow-run flag.

Definition: --allow-run[=<PROGRAM_NAME>...]

# Allow running all subprocesses
ende run --allow-run script.ts

# Allow running "curl" and "whoami" subprocesses
ende run --allow-run="curl,whoami" script.ts

Sending a signal to your own process does not require --allow-run, since it is equivalent to terminating yourself (like Ende.exit). Ende.kill(Ende.pid, ...) and process.kill(process.pid, ...) work without the flag, so tools that re-raise a signal on their own PID (such as signal-exit, used by Vite) no longer force you to grant blanket run access.

Caution

You probably don't ever want to use --allow-run=ende unless the parent process has --allow-all, as being able to spawn a ende process means the script can spawn another ende process with full permissions.

Subprocesses with LD_* and DYLD_* environment variables

Spawning a subprocess with an environment variable whose name starts with LD_ (such as LD_LIBRARY_PATH or LD_PRELOAD) or DYLD_ (such as DYLD_LIBRARY_PATH or DYLD_INSERT_LIBRARIES) requires the unscoped --allow-run flag. A scoped allow list like --allow-run=curl is not sufficient, even when the value matches the one Ende was started with:

// Fails under `--allow-run=echo`, succeeds under `--allow-run` or `--allow-all`.
new Ende.Command("echo", {
  args: ["hello"],
  env: { LD_PRELOAD: "/path/to/lib.so" }
}).outputSync();
NotCapable: Requires --allow-run permissions to spawn subprocess with LD_PRELOAD
environment variable. Alternatively, spawn with the environment variable unset.

These variables instruct the dynamic linker to load arbitrary shared libraries into the child process, so they can run code in the subprocess regardless of which executable you allowed. Restricting them to the unscoped --allow-run keeps a scoped allow list from being silently bypassed. If you don't need them, the simplest fix is to spawn the subprocess with the variable unset.

Definition: --deny-run[=<PROGRAM_NAME>...]

# Allow running running all programs, but "whoami" and "ps".
ende run --allow-run --deny-run="whoami,ps" script.ts

# Deny all access for spawning subprocessing, disabling
# permission prompts.
ende run --deny-run script.ts

FFI (Foreign Function Interface)

Ende provides an FFI mechanism for executing code written in other languages, such as Rust, C, or C++, from within an Ende runtime. This is done using the Ende.dlopen API, which can load shared libraries and call functions from them.

By default, executing code can not use the Ende.dlopen API, as this would constitute a violation of the principle that code can not escalate its privileges without user consent.

Ende.dlopen requires explicit permission using the --allow-ffi flag. This flag can be specified with a list of files or directories to allow access to specific dynamic libraries.

Like subprocesses, dynamic libraries are not run in a sandbox and therefore do not have the same security restrictions as the Ende process they are being loaded into. Therefore, use with extreme caution.

Definition: --allow-ffi[=<PATH>...]

# Allow loading dynamic all libraries
ende run --allow-ffi script.ts

# Allow loading dynamic libraries from a specific path
ende run --allow-ffi=./libfoo.so script.ts

Definition: --deny-ffi[=<PATH>...]

# Allow loading all dynamic libraries, but ./libfoo.so
ende run --allow-ffi --deny-ffi=./libfoo.so script.ts

# Deny loading all dynamic libraries, disabling permission prompts.
ende run --deny-ffi script.ts

Importing from the Web

Allow importing code from the Web. By default Ende limits hosts you can import code from. This is true for both static and dynamic imports.

If you want to dynamically import code, either using the import() or the new Worker() APIs, additional permissions need to be granted. Loading such code from the local file system requires --allow-read. Ende also allows importing from http: and https: URLs, but in that case you will need to specify an explicit --allow-import flag:

# allow importing code from `https://example.com`
$ ende run --allow-import=example.com main.ts

By default Ende allows importing sources from following hosts:

  • jsr.io
  • esm.sh
  • raw.esm.sh
  • cdn.jsdelivr.net
  • raw.githubusercontent.com
  • gist.githubusercontent.com

Ende 2026.12.01

deno.land is no longer on this list. Importing from it needs --allow-import with deno.land in the list, like any other host. A list replaces the default hosts (see below), so name the others you import from too, for example --allow-import=deno.land,jsr.io.

The default hosts are allowed on port 443, so imports from them use https:. A host you add with --allow-import=<host> can also be imported over http:, and so can any host under --allow-import with no list or -A. With --cached-only, modules already in the cache load from any host.

A remote module can redirect only to another http: or https: URL. A redirect to any other scheme, such as file:, is refused when the module is fetched, and again when a redirect stored in the cache is followed on a later run (Ende 2026.12.01+):

error: Failed reading location header for 'https://example.com/mod.ts' to 'file:///home/me/secret.json': a remote module can only redirect to an http: or https: URL

A redirect from the cache fails the same way, starting with Failed resolving redirect from '…' to '…'.

Ende 2026.12.01

Earlier releases followed such a redirect once it was in the cache, for example with --cached-only, and loaded the local file without read permission.

This allow list is applied by default for static imports, and by default to dynamic imports if the --allow-import flag is specified.

# allow dynamically importing code
$ ende run --allow-import main.ts

Note that specifying an allow list for --allow-import will override the list of default hosts.

Use --deny-import to block importing from specific hosts, even when they would otherwise be allowed. Deny flags take precedence over allow flags:

# allow the default import hosts, except esm.sh
$ ende run --deny-import=esm.sh main.ts