Security Policy & Architecture Posture
Summary of SECURITY.md: private vulnerability disclosure, shipped Ferro v1.0 security controls, and documented isolation boundaries.
Reporting a Vulnerability
Private Vulnerability Disclosure
Security contact: [email protected]
- Please do not open public GitHub issues for suspected security vulnerabilities.
- Send suspected vulnerability reports privately to the security contact above (or use GitHub Private Vulnerability Reporting for upstream issues).
- Include clear reproduction steps, affected files or commit SHAs, deployment mode (Relay vs. Direct,
systemdvs.bwrap), and potential security impact so the issue can be triaged and patched promptly.
Documented Isolation Boundaries
Ferro v1.0 enforces OS-level job sandboxing, encrypted transport, and strict Control Plane multi-tenancy by default. We document the remaining host-level and storage boundaries explicitly so operators can harden deployments appropriately:
OS-level job sandbox boundaries (shared Linux kernel & host network)
ferro-agent enforces a per-run OS sandbox by default (--sandbox=auto), preferring systemd-run transient units under a dedicated ferro-job UID with mount namespaces and cgroup v2 MemoryMax (default 4G, MemorySwapMax=0), TasksMax (default 256), and optional CPUQuota limits, falling back to bwrap (user/mount/PID namespaces), and failing closed unless --sandbox=none --i-understand-jobs-are-not-isolated is explicitly passed. Remaining boundaries: jobs share the host Linux kernel (no KVM/Firecracker microVM boundary) and host network namespace (so builds can reach outbound registries or loopback/LAN/cloud-metadata endpoints such as 169.254.169.254 unless restricted by host firewall rules). Under systemd, Polkit isolates untrusted jobs (ferro-job) from ferro + host rather than a compromised ferro agent process from root; on Ubuntu 24.04 AppArmor restricts unprivileged user namespaces for bwrap (prefer systemd), and bwrap without systemd --user omits cgroup limits.
No hard per-run disk quota (bounded-time LRU eviction on persistent stores)
ferro-agent removes per-run work/ directories after completion and runs bounded-time size-based LRU disk eviction at startup and after each run across <work_dir>/cache/warm (FERRO_CACHE_MAX_GB, default 20), <work_dir>/blobs (FERRO_BLOBS_MAX_GB, default 10), and <work_dir>/mirrors (FERRO_MIRRORS_MAX_GB, default 10), skipping entries pinned by active runs. However, cgroup limits do not cap disk bytes written inside a run's writable workspace, TMPDIR, or scoped project cache during execution unless /var/lib/ferro-agent resides on a quota-enforced filesystem.
Control Plane secret decryption at dispatch & Relay / Artifact / Smart Cache storage
Project environment secrets, Relay CLI --env overrides, GitHub webhook secrets, GitHub tokens, OIDC client secrets, and cloud provider tokens are encrypted at rest with AES-256-GCM in PostgreSQL (src/lib/vault.ts), but the Control Plane holds VAULT_MASTER_KEY and decrypts secrets in memory to send envSecrets over the authenticated POST /api/agent/claim response (trusted runs only) and to redact ingested log chunks. In default zero-inbound-port Relay Mode, workspace blobs transit the Control Plane (stored org-scoped with TTL cleanup in PostgreSQL or optional S3-compatible object storage). When configured or enabled, uploaded Run Artifacts (chunked tar+zstd archives), parsed JUnit test reports, and Smart Test Cache metadata/output blobs are similarly stored org-scoped in PostgreSQL or S3-compatible storage subject to plan quotas and TTL expiration.
Implemented Security Controls
- Multi-tenant isolation: every web, CLI, agent, relay blob, Run Artifact, Smart Test Cache, and billing query is scoped by verified orgId derived from the authenticated session or hashed bearer token.
- Per-run OS job sandboxing & cgroup enforcement: ferro-agent isolates every CI, direct-offload, and relay-offload job via systemd-run under a dedicated ferro-job UID (read-only rootfs, private /tmp, /var/tmp, and /dev/shm, blocked access to /etc/ferro, /run/credentials, blobs/, mirrors/, agent-home/, private/, sibling workspaces, and other projects' caches, plus cgroup v2 MemoryMax/TasksMax/CPUQuota and full cgroup teardown on exit/timeout/cancel) or bwrap fallback, failing closed unless --sandbox=none --i-understand-jobs-are-not-isolated is explicitly supplied.
- Default zero-inbound-port Relay Mode & opt-in pinned-TLS Direct Mode: ferro-agent defaults to Relay Mode (no inbound port exposed; direct listener binds 127.0.0.1:7420 unless FERRO_BIND_ADDR is overridden) with HTTPS blobs and TTL cleanup in PostgreSQL or S3-compatible storage. Opt-in Direct Mode uses built-in rustls TLS with a persistent self-signed certificate whose SHA-256 leaf fingerprint (directTlsFingerprint) is pinned by ferro-cli, refusing non-loopback http:// URLs.
- Asymmetric Ed25519 offload tickets (v2): the Control Plane signs short-lived (<= 10 min) Ed25519 tickets (OFFLOAD_SIGNING_KEY) binding runId, nodeId, orgId, commandHash, envHash, manifestHash, expiry, and single-use jti; agents pin the Control Plane public key on first register, verify X-Ferro-Ticket headers in middleware before reading request bodies, and persist used JTIs across restarts.
- Warm dependency cache isolation & bounded-time LRU eviction: cache restore/save execute outside the job sandbox on the agent side (<work_dir>/cache/warm is 0700 agent-only and masked from jobs), using copy-on-restore, stripping SUID/SGID bits, atomic rename saves, and branch/PR isolation so untrusted PR runs cannot pollute default-branch caches; LRU eviction caps cache/warm, blobs, and mirrors at startup and post-run.
- Blob & git workspace integrity: BlobStore::materialize_workspace re-verifies every blob's SHA-256 digest before materializing; agent git commands run with private 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 excludes sensitive files (.env, private keys, cloud credentials) by default.
- Agent credential isolation & hashed bearer tokens: install scripts and cloud-init store /etc/ferro/node-token as 0600 root:root loaded via systemd LoadCredential and scrub credential env vars at startup. Node tokens (frn_...) and CLI tokens (frk_...) use 32 random bytes, are shown plaintext once at creation, are stored only as SHA-256 hashes, and are verified via crypto.timingSafeEqual.
- AES-256-GCM secrets vault & log redaction: project env secrets, Relay --env overrides, webhook secrets, GitHub/cloud tokens, and OIDC client secrets are encrypted at rest and returned to web clients as masked previews only; both ferro-agent and the Control Plane scrub known secret values (including multi-line, base64, and percent-encoded variants) from stdout/stderr log chunks.
- Account security, 2FA & OIDC SSO: Better Auth email verification (required in production), password policy (10–128 characters), password reset with session revocation, TOTP two-factor authentication with org-level enforcement, Scale OIDC SSO with PKCE and browser binding, Resend/console mailer fail-closed checks, and durable proxy-safe rate limiting (TRUSTED_PROXY_HOPS).
- Fail-closed webhooks, Run Artifacts & Smart Test Cache scoping: GitHub webhooks verify X-Hub-Signature-256 (HMAC-SHA256) and Stripe webhooks verify live signatures fail-closed; fork PRs default to require_approval with project secrets withheld and Smart Test Cache writes blocked on untrusted runs; Run Artifacts enforce plan limits, SHA-256 checks, TTL expiry, and short-lived HMAC-signed download tokens.
- Verified release artifacts & fail-closed production env checks: tagged releases publish SHA256SUMS plus keyless Sigstore Cosign signatures verified by install scripts; in production runtime, DATABASE_URL, BETTER_AUTH_SECRET, VAULT_MASTER_KEY, OFFLOAD_SIGNING_KEY, and mailer config fail closed if missing or weak, simulators are disabled, and ENABLE_DEMO_MODE defaults to false.
For deeper architectural details on isolation boundaries, token lifecycles, and secret handling, see Docs → Security Model.