architecture
Permission model and isolation
How capability grants are enforced across DNS, symlinks, SQLite, worker threads, and the OS sandbox.
Deny by default, monotonic narrowing
Permission state lives in native C3 memory outside the JS heap. Every call that touches the network, filesystem, environment, or child processes checks that state before doing any work. Deny rules run before allow rules, so --deny-net=169.254.169.254 blocks that address even with -A.
When interactive prompting is off (--no-prompt, prompt = false in boomkat.toml, non-TTY stdio, or inside a worker thread), grants are locked for the process: scripts can narrow their access with permissions.revoke(), but cannot widen it.
DNS rebinding and private network protection
Outbound connections check permissions twice: once against the requested hostname and port before DNS resolution, and again against every IP address returned by getaddrinfo.
A hostname grant like --allow-net=example.com only covers public IP addresses. If DNS resolves that hostname to a loopback, link-local, or private range (127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16, ::1, fe80::/10, fc00::/7), the connection is rejected unless that internal address (or localhost for loopback) was explicitly granted.
Path canonicalization and symlink refusal
Filesystem grants and target paths are canonicalized with realpath before prefix matching, with a 1-second directory cache for non-symlink leaves. To block TOCTOU symlink swaps after the check, native file opens pass O_NOFOLLOW_ANY on macOS (refusing symlinks anywhere in the path) and O_NOFOLLOW on Linux (refusing a symlink at the final path component).
SQLite confinement
Opening a file database checks read (and, unless readonly: true, write) permissions for the normalized database path plus its -journal, -wal, and -shm sidecars. Every connection installs a SQLite authorizer callback and forces PRAGMA temp_store=MEMORY, blocking ATTACH DATABASE, VACUUM INTO, load_extension(), and temp-directory changes so SQL cannot read or write outside the checked path.
OS sandbox
When prompting is off on macOS, runtime/sandbox.c3 builds a Seatbelt profile from the active grants and calls sandbox_init before evaluating the entry module:
- With no
netgrant, the kernel denies all network sockets. - With no
rungrant,process-exec*andprocess-forkare denied. - When
writeis scoped, file writes are limited to the canonical granted subpaths and/dev/.
Linux enforces permissions in the runtime only and prints a startup warning unless --no-sandbox is passed.