ff.json section, no environment variable, and no runtime toggle.
The only input is --allow-* on the command line.
Quick look
ff <file>,
ff -e, ff start, ff test, ff repl, and ff --watch.
Flags
Rules:
- Flags are repeatable and comma-split:
--allow-read=src,test. - A bare flag grants the whole category:
--allow-netmeans any host, any port. - An empty scope is invalid:
--allow-read=fails at startup. - There are no
--deny-*flags. Unknown permission flags fail startup. - Scopes are parsed once, before the JS runtime exists, and are immutable for the process lifetime.
- Flags are scanned across the whole argv. A script argument that begins with
--allow-is interpreted as a permission flag, not passed to the script.
Path scopes
- Relative scopes resolve against the launch cwd, then stay fixed.
- Matching is component-exact:
--allow-read=/srv/appcovers/srv/app/data.json, not/srv/app2/data.json. - Symlinks are resolved before matching. The resolved target must be inside a scope. A symlink inside an allowed directory that points outside is denied.
- Writes through a dangling symlink are denied.
..traversal, NUL bytes, and paths at or beyond 4096 bytes are denied.process.chdir()does not move the scope roots. After achdir, a relative API path resolves against the new cwd and must still land inside a scope captured at startup.- Bare
--allow-read/--allow-writegrant every path.
Network scopes
- Hostnames are matched case-insensitively and exactly. There is no DNS
resolution:
localhostand127.0.0.1are different scopes. *.example.commatches one or more subdomain labels, but not the apexexample.com.*matches every host and every port. A port suffix on*does not narrow it; use*.example.comfor a scoped wildcard.- When the port is omitted, any port is allowed.
fetchandWebSocketdefault to 80/443 when the URL has no explicit port. http.serve()always binds0.0.0.0, so its scope must be--allow-net=0.0.0.0:<port>— not127.0.0.1:<port>.- IPv6 literals use brackets:
[::1]:3000.
Environment scopes
- Names are exact and case-sensitive. There is no wildcard.
process.envis built once at startup with disallowed keys omitted. Reading a disallowed name returnsundefined; it does not throw.- The runtime still reads its own
FF_*configuration (FF_ECHO,FF_CERT,FF_KEY,FF_CA_FILE). That is CLI/runtime configuration, not application access toprocess.env.
Run scopes
- A bare name matches the basename of
argv[0].--allow-run=gitalso permits./gitand/tmp/git; use an absolute scope when that matters. - An absolute scope matches that path or a directory subtree.
execandexecSyncalways run/bin/sh -c. They need/bin/shin scope, and granting/bin/shpermits any command string.spawnchecks onlyargv[0], so spawning a shell has the same effect.runis trust-equivalent to full process access. Treat it like--allow-all.
FFI
- Bare only:
--allow-ffi=.is invalid. --allow-allincludes FFI.ffi.allowedreports the current state. Every otherffientry point —dlopen,callback,ptr,view,cstring,read,write,copyBytes,writeBytes,struct,union,isNull— requires the flag.- Native code runs with the full privileges of the
ffprocess. FFI bypasses every other permission, so--allow-ffiis trust-equivalent to full access.
Where checks happen
Database.open(":memory:") is exempt from all path checks. Inline PEM passed to
http.serve({ tls: { cert, key } }) is exempt from read; a path is not.
Errors
Most gates throw anError with a stable name and code:
e instanceof Erroris true, but there is no globalPermissionDeniedconstructor. Checke.codeore.name;instanceof PermissionDeniedwill not work.- Denials are thrown before I/O, jobs, promises, children, or sockets are
created. The
*Asyncfs variants throw synchronously, before returning a promise. Inside anasyncfunction that becomes a rejected promise. - Initial
fetchdenial throws synchronously. A denial on a redirect hop rejects the fetch promise with a plain string:PermissionDenied: fetch requires --allow-net. That string has no.code. - FFI uses the same error shape but has no scope suffix:
ffi.read requires --allow-ffi.ffi.allowedisfalsewithout the flag.
Lifetime and inheritance
- The policy is parsed before any runtime object exists and never changes.
globalThis.permissionsexposes booleans for the six categories:read,write,net,env,run,ffi. A category istruewhen it has any grant, bare or scoped.- The object reports enabled categories only; it does not expose the scopes. Reassigning its properties does not change enforcement.
- Workers inherit the same policy. There is no per-worker grant or drop.
ff --watchforwards permission flags to the child it restarts.ff startaccepts the flags afterstart;--cert/--keyare CLI configuration reads and are not gated by--allow-read.
Program-loading carve-out
Loading code is not aread operation:
import/exportresolution and module file reads.ff startreadingff.jsonand itsmainfile.ff testloadingtest/*.test.js.new Worker("./worker.js")loading the worker file.
--allow-read. Permissions gate what the loaded code does
at runtime, not whether it can be loaded. A worker that calls fs.readFile
still needs its own --allow-read grant (inherited from the parent).
ff imprint, ff fmt, ff upgrade, and ff compile are CLI operations, not
runtime APIs. They are not gated by these flags.
Security model
Permissions are an in-process policy layer, not an OS sandbox.- A path is canonicalized and then passed to a normal filesystem syscall. A symlink swapped between the check and the syscall can escape the scope.
runandffiare trust-equivalent to full access; native code and child processes are not confined.- Module loading is a carve-out. Importing untrusted code gives that code the permissions of the process.
- Scopes are process-global. There is no per-request or per-user narrowing.
Migration
Start with the narrowest scope that works and widen only when the runtime tells
you which flag and detail were denied.