Security Model
An honest technical reference of Ferro's implemented OS-level job sandbox, credential controls, remaining shared-kernel caveats, and operator hardening guidance.
OS-level job sandboxing — shared Linux kernel (no microVM boundary)
ferro-agent enforces a per-run OS sandbox by default (--sandbox=auto: transient systemd-run units under a dedicated ferro-job UID with mount namespaces and cgroup v2 limits, falling back to bwrap, and failing closed unless --sandbox=none --i-understand-jobs-are-not-isolated is explicitly passed). Jobs still share the host Linux kernel and host network namespace and have no hard per-run disk quota unless /var/lib/ferro-agent sits on a quota-enforced filesystem. Treat OS sandboxing as strong process/filesystem/cgroup isolation for team and reviewed-PR workloads — not a multi-tenant Firecracker/KVM microVM boundary.
Isolation & Control Matrix
| Layer | Posture | Current Implementation |
|---|---|---|
| Multi-tenant Control Plane isolation | Implemented | Every authenticated web, CLI, agent, and billing query scopes by verified orgId derived from the session or SHA-256 hashed bearer token. Scale orgs support OIDC SSO with DNS domain verification, PKCE, and optional enforcement. |
| Node & CLI bearer tokens | Implemented | 32 random bytes (frn_... / frk_...), displayed plaintext once on creation, stored only as SHA-256 hashes, verified with crypto.timingSafeEqual. ferro login reads tokens from stdin or a no-echo TTY prompt. |
| Agent credential isolation (LoadCredential) | Implemented | Installers and cloud-init write /etc/ferro/node-token as 0600 root:root and pass it via systemd LoadCredential — never placing FERRO_NODE_TOKEN in /etc/ferro/agent.env. ferro-agent scrubs credential env vars at startup, clears child environments to an explicit allowlist, and redacts the node token from logs. |
| Secrets encryption at rest vs. dispatch | Caveat | Repository secrets, Relay --env overrides, GitHub tokens/webhooks, and cloud provider tokens are encrypted at rest in PostgreSQL with AES-256-GCM (versioned key ring + row-bound AAD; web UI receives masked previews only). The Control Plane holds VAULT_MASTER_KEY, decrypts secrets in memory for authenticated POST /api/agent/claim responses on trusted runs, and decrypts them when redacting ingested log chunks. |
| Offload transport (Relay default & Direct TLS) | Implemented | Nodes default to zero-inbound-port Relay Mode (loopback bind 127.0.0.1:7420) where workspace blobs transit the Control Plane over HTTPS with org-scoped TTL cleanup (PostgreSQL or S3-compatible storage). Opt-in Direct Mode requires https:// with rustls TLS using a persistent self-signed cert pinned by SHA-256 fingerprint in ferro-cli, plus Ed25519 v2 tickets (pinned public key, single-use jti) verified before body parsing. |
| Per-run OS job sandbox & cgroup limits | Implemented | ferro-agent enforces --sandbox=auto fail-closed on every CI, direct-offload, and relay-offload run: systemd-run transient units under dedicated unprivileged UID ferro-job (or bwrap fallback with user/mount/PID namespaces), read-only rootfs (ProtectSystem=strict), masked /etc/ferro, /run/credentials, blobs/, mirrors/, agent-home/, private/, sibling workspaces & other project caches, private /tmp /var/tmp /dev/shm, cgroup v2 MemoryMax (default 4G, MemorySwapMax=0), TasksMax (default 256), optional CPUQuota, and full cgroup/PID-namespace teardown on exit, timeout, or cancel. |
| Shared kernel, host network & Polkit boundaries | Caveat | OS sandboxing shares the host Linux kernel (no Firecracker/KVM microVM boundary) and shares the host network namespace so builds can fetch dependencies and reach test services (restrict LAN/cloud-metadata 169.254.169.254 via host nftables/iptables rules). Under systemd, /etc/polkit-1/rules.d/50-ferro-agent.rules isolates untrusted ferro-job workloads from the ferro agent and host, not a compromised ferro agent from root. On Ubuntu 24.04 AppArmor restricts unprivileged userns for bwrap (prefer systemd); bwrap without systemd --user enforces filesystem/PID namespaces without cgroup limits. |
| Warm dependency cache & fork PR trust | Implemented | Fail-closed HMAC-SHA256 webhook verification; fork PRs default to require_approval and untrusted runs never receive project secrets. Warm cache restore/save executes agent-side outside the sandbox from 0700 <work_dir>/cache/warm via copy-on-restore (never mutable hardlinks), skipping escaping symlinks and stripping SUID/SGID bits. Untrusted runs read the default-branch cache read-only and save only to isolated pr-<number> keys; trusted runs never read untrusted PR caches. |
| Blob & git workspace integrity | Implemented | BlobStore::materialize_workspace streams private copies while re-verifying SHA-256 digests before persisting (failing closed on tampering). Agent git operations fail closed on clone/fetch/checkout errors using private <work_dir>/agent-home, GIT_CONFIG_NOSYSTEM=1, GIT_CONFIG_GLOBAL=/dev/null, core.hooksPath=/dev/null, core.fsmonitor=false, protocol.ext.allow=never, and --no-hardlinks. ferro-cli skips sensitive files by default; both agent and Control Plane perform best-effort secret log redaction. |
| Disk LRU eviction vs. per-run disk quotas | Caveat | ferro-agent enforces size-based LRU eviction at startup and after each run on cache/warm (FERRO_CACHE_MAX_GB, default 20), blobs/ (FERRO_BLOBS_MAX_GB, default 10), and mirrors/ (FERRO_MIRRORS_MAX_GB, default 10), skipping active-run pins. However, cgroup limits do not cap disk bytes written inside a single run's writable workspace or TMPDIR unless /var/lib/ferro-agent sits on a quota-enforced filesystem. |
Where Source Code and Secrets Travel
- Source code: In default Relay Mode,
ferrodelta-uploads missing SHA-256 blobs over HTTPS to the Control Plane (capped at 256 MiB/run and 32 MiB/file, stored with TTL in PostgreSQL or S3-compatible storage), and the claimingferro-agentfetches and re-hashes each blob. In opt-in Direct Mode, files sync directly fromferrotoferro-agentover pinned-fingerprint TLS. In GitHub CI mode, the runner clones straight from GitHub into<work_dir>/mirrorsusing short-lived single-repocontents:readtokens (GitHub App) via an isolatedGIT_ASKPASShelper. - Project secrets: Encrypted in PostgreSQL with AES-256-GCM using
VAULT_MASTER_KEY(with versioned key ring rotation and row-bound AAD). Decrypted in memory by the Control Plane only when returningPOST /api/agent/claimfor atrusted = truerun and when scrubbing secret values from incoming log chunks. - Agent credentials:
/etc/ferro/node-tokenis written0600 root:rootand loaded via systemdLoadCredential; the agent scrubs credential env vars at startup and isolates jobs under theferro-jobUID with/etc/ferroand/run/credentialsmasked out. - Offload tickets (v2): Short-lived (≤ 10 min) Ed25519-signed tickets minted with
OFFLOAD_SIGNING_KEYbindrunId,nodeId,orgId,commandHash,envHash,manifestHash, expiry, and a single-usejti(persisted across restarts). Agents pin the Control Plane public key on first registration and verifyX-Ferro-Ticketbefore parsing request bodies.
Operator Hardening Checklist
- Terminate TLS in front of the Control Plane (HTTPS), keep runners in default Relay Mode (no inbound port), and only enable Direct TLS on port
7420over a trusted LAN/VPN when you need direct workstation-to-node streaming. - Keep
--sandbox=autoenabled (preferring thesystemdbackend on Ubuntu 24.04+ servers where AppArmor restricts unprivileged userns forbwrap), and restrict outbound access from runners to cloud metadata (169.254.169.254) and private LANs vianftables/iptables(Hetznercloud-initapplies metadata blocking automatically). - Keep
forkPrPolicyset torequire_approval(default) ordisabledon public repositories, review PR diffs before approving, and avoid mixing untrusted public PR runners with sensitive internal-network nodes. - In production, set strong unique values for
BETTER_AUTH_SECRET,VAULT_MASTER_KEY, andOFFLOAD_SIGNING_KEY(base64 32-byte Ed25519 seed), keepENABLE_DEMO_MODEunset/false, and never setFERRO_UNSAFE_ALLOW_SIMULATORS_IN_PRODUCTION. - Size
FERRO_CACHE_MAX_GB(default 20),FERRO_BLOBS_MAX_GB(default 10), andFERRO_MIRRORS_MAX_GB(default 10) for your NVMe disk, and place/var/lib/ferro-agenton a dedicated partition or quota-enforced filesystem if you need a hard per-run disk cap.
To report a security vulnerability privately, see the Security Policy page (mirroring SECURITY.md).