fs:* capabilities gate file system access. They are enforced by hooking require('fs') and all its variants in the preload — the same mechanism used for require('http') and require('https').
Capability table
| Capability | What it gates |
|---|---|
fs:read | readFile, readFileSync, readdir, readdirSync, createReadStream, stat, statSync, exists, existsSync, open (read mode), watch, watchFile |
fs:write | writeFile, writeFileSync, appendFile, appendFileSync, createWriteStream, unlink, unlinkSync, mkdir, mkdirSync, rename, renameSync, open (write mode) |
Shorthand expansions
| Shorthand | Expands to |
|---|---|
fs:all | fs:read + fs:write |
All fs module variants must be hooked
Why this gate exists
Withoutfs:* enforcement, any node package can freely call require('fs') and:
- Read
settings.jsto extract the credential encryption key and admin passwords - Read
flows_cred.jsonto obtain raw encrypted credentials - Read
.envfiles or SSH keys from the host - Overwrite flow and credential files directly, bypassing the entire HTTP deploy pipeline
Blocked operation warning format
settings.js example
Gap — fs:* has no path allowlist
Gap — fs:* has no path allowlist
A package granted
fs:read can read any file on the host with no restriction on which paths are accessible. There is no mechanism to say “only read from /data/”. A path allowlist for fs is not yet designed.