Skip to content

v0.6.0: Secrets hardening, enterprise mode, audited cluster security

Choose a tag to compare

@sumansaurabh sumansaurabh released this 28 Sep 22:38
dc8af75

AerolVM v0.6.0: secrets hardening, enterprise mode, audited cluster security

Highlights

  • HA sandboxes keep their credentials when the owner node dies. Secrets are sealed to the owner plus backups, and the sandbox is recreated on a backup with working credentials.
  • No plaintext secrets at rest or in the Raft log. Env and toolbox tokens are sealed; a plaintext secret column refuses to boot.
  • Every secret access is audited. The log is hash-chained and exportable off-node. The chain shows a changed record, but someone with root on a node could rebuild that node's chain, so keep an off-node copy. Anchoring the chain to an external witness needs a witness provider, which the open-source build does not include yet.
  • Cluster-internal traffic runs over node-bound mTLS, and tenant tokens can never write secrets.
  • SB_ENTERPRISE_MODE: the node refuses to boot in any unsafe configuration. It requires an external audit witness, so the open-source build cannot start in this mode yet.
  • AWS KMS as a secrets provider (SB_SECRET_PROVIDER=awskms).
  • Hardened V8-isolate jail: chroot, cgroup v2, uid drop, seccomp, PID namespace.
  • Opt-in ingress routing with no Caddy reloads per sandbox: 0 dropped connections under churn (SB_INGRESS_PROXY_ROUTING).

Secrets and credentials

  • Recipient-set sealing: HA creates (failover.policy=recreate) seal to the owner + SB_SECRET_RECIPIENT_BACKUP_COUNT backups (default 2).
  • Recipients are chosen once at reserve time and recorded in Raft (SecretRecipients). Raft never carries ciphertext.
  • A create waits a bounded time for at least one backup to acknowledge (SB_SECRET_FANOUT_MIN_ACK_WAIT, default 2s). A create with zero acknowledgements is retracted, leaving no orphan sandbox.
  • A durable put outbox, written in the same transaction as the sealed row, finishes fan-out asynchronously with backoff.
  • A new failover_ready field on Get/List is true only when the owner plus at least one live backup hold the current generation.
  • Failover recreates only onto nodes that hold the secret. A non-recipient fails with recipient_denied, never with an empty env.
  • Reseal on membership change: a node joining, a node draining, or a recipient dying. Reseals are generation-bound and use a Raft compare-and-swap, and concurrent triggers converge.
  • Tombstones stop a delayed fan-out from resurrecting a destroyed sandbox's secrets.
  • Delete outbox: a secret copy counts as removed only on a generation-scoped delete acknowledgement, not because the node disappeared from gossip.
  • Mount credentials are sealed. Credential-shaped mount options (password, token, access_key, …) are refused on create.
  • The toolbox token is sealed with sandbox-bound associated data (AAD).

Secrets providers

  • local (default): node AES key or SB_CREDENTIAL_ENCRYPTION_KEY.
  • awskms: KMS wraps each data key, with no DEK cache. A strict-boot canary is available (SB_SECRET_PROVIDER_STRICT_BOOT).
  • vault is named but not implemented, and fails closed at boot (no silent fallback).

Env sealing (API change)

  • Env is stored sealed in a dedicated sandbox_env table and never sits on the hot list scanner.
  • The warm upgrade seals legacy env_json in one transaction, scrubs it, and drops the column; a failure rolls everything back.
  • GET/LIST omit env by default. ?include_env=true returns it and writes exactly one audit event.
  • All 5 SDKs support it: TypeScript includeEnv, Python include_env, Go WithIncludeEnv, Rust, Java.

Audit trail

  • Every secret open writes an event: cluster provider, registry unseal, mount unseal, include_env. Events never contain plaintext.
  • Append-only JSONL with a hash chain (prev_hash / event_hash). POST /v1/audit/verify checks it and names the exact broken record.
  • Boot verification (full | checkpoint) in O(1) memory; a torn tail is repaired at boot.
  • Reads are cluster-wide: GET /v1/sandboxes/{id}/audit fans out to peers and includes a coverage block, so an unreachable node is reported as missing, never silently dropped.
  • Paged, indexed reads, with no duplicates or gaps across pages.
  • Rate limits are per identity plus a per-node ceiling (429 + Retry-After).
  • Overflow writes an explicit gap marker, and a disk spill drains back with the chain intact.
  • Export connectors: stdout | file | webhook (HMAC + bearer) | s3 | bus. Delivery is at-least-once with an Idempotency-Key.
  • Retention never discards records that haven't been exported yet.
  • External witness (needs a witness provider, which the open-source build does not include yet): chain heads are shipped off-node. A node whose local chain disagrees with its receipt refuses to boot.
  • Audit access is bound to the sandbox incarnation, and history is readable after delete within the retention window.

Cluster security

  • Cluster mode requires SB_CLUSTER_TLS_DIR: node-bound mTLS on a dedicated internal listener.
  • Client certs must be CA-signed with a node:<id> SAN. Shared-SAN and CN-only certs are refused.
  • Internal routes are refused on the public listener. A plaintext call to the internal port is refused.
  • A failed mTLS handshake is never retried over the PAT alone.
  • Certificates hot-reload with no restart.
  • Secret PUT/DELETE require operator PAT + mTLS. Managed tenant tokens get 403.
  • A peer push from a foreign identity is refused, and replaying a push is idempotent.
  • CSR-based node enrollment, bound to the caller's cloud identity (scripts/cluster-sign-node.sh).

Enterprise mode (SB_ENTERPRISE_MODE=true)

  • Requires an external audit witness. The open-source build has none yet, so it refuses to start in this mode.
  • Refuses to boot with any unsafe combination. Each refusal has a documented message.
  • Refuses to boot if a CA signing key (ca.key) is in the daemon TLS directory; keep the signing key offline.
  • Refuses to boot with an on-node-only audit exporter; an off-node export backend is required.
  • Requires backup count ≥ 1 and a non-zero acknowledgement wait.
  • Insecure gossip and credential escape hatches are disabled.
  • Refuses to boot on witness disagreement, and the refusal persists across restarts.
  • Can require the isolate jail (SB_ISOLATE_USE_JAIL).
  • Survives an election at boot (fixed a permanent crash loop), and a node rejoins cleanly after every boot-gate check.

Isolate (workerd) jail

  • Per-group chroot, cgroup v2, uid drop, no_new_privs, and a seccomp allowlist applied before execve.
  • CLONE_NEWPID stops a jailed tenant from signalling other tenants; kill/tkill are never allowed.
  • /tmp and /run are noexec tmpfs.
  • The jail refuses to start as non-root instead of failing every create.
  • Per-sandbox egress attribution holds under the jail.

Ingress proxy routing (opt-in, SB_INGRESS_PROXY_ROUTING=true)

  • Caddy holds static routes only, so creating, exposing or destroying a sandbox writes nothing to Caddy.
  • A loopback DNS responder in sandboxd answers where each host goes. Ingress indexes are fed by a versioned placement delta feed.
  • Raw-TCP host ports are forwarded by kernel NAT (DNAT via conntrack), so established sessions survive sandboxd restarts.
  • Flag-on and flag-off are each one Caddy load, with automatic rollback when the flag is turned off.
  • Fallback router answers: 421 for misdirected requests (all 5 SDKs retry on 421), 503 while in flux, and 404 for unknown hosts.
  • No on-demand TLS on ingress-only nodes, so tenant certificates stay on owner nodes.
  • Default: off.

Storage retirement

  • Draining a node raises a visible storage-retirement obligation, and an attestation discharges it (GET /v1/cluster/storage-retirements).

Reliability fixes (found on live multi-node clusters)

  • A restarted seed with no configured peers now rejoins Raft (persisted gossip peer cache).
  • An enterprise worker restart no longer crash-loops on rejoin.
  • A dedicated ingress now installs L4 routes for remote sandboxes.
  • containerd no longer records the node IP as a gVisor sandbox's address.
  • Templates are readable immediately after create, and placement accepts a template as soon as it is ready.
  • toolboxd: an exec child's exit status is preserved when the PID-1 reaper races it (a read-only volume write now correctly fails).
  • DELETE no longer answers 404 on success.
  • A containerd stop no longer deletes the sandbox.
  • Caddy route upserts no longer race Caddy's @id index.
  • Fleet-scale reads are paged: reconcile is paged by owner, and list and failover-readiness are batched per page.
  • Bounded cluster caches; a Raft replica admission cap; a capacity-lease admission race.
  • The forwarded exec/log/upload/WebSocket 30s timeout is removed on the internal listener.

Security dependency updates

  • Go 1.26.6, golang.org/x/crypto 0.56.0.
  • containerd bumped for CVE-2026-53495.
  • Other disclosed advisories patched.

Breaking changes and upgrade notes

  • API: env is absent from GET/LIST unless include_env=true is passed. failover_ready is added for recreate-policy sandboxes.
  • Cluster deploys: SB_CLUSTER_TLS_DIR and node-bound certificates are required.
  • HA create: can take up to SB_SECRET_FANOUT_MIN_ACK_WAIT longer (default 2s), and fails if no backup acknowledges.
  • On disk: an automatic, transactional migration moves env_json → sandbox_env and the toolbox token → toolbox_token_sealed. Boot refuses a database that still has plaintext secret columns.
  • Audit reads: rate-limited (429).
  • Default (non-HA) create: one extra sealed-env INSERT, and no peer I/O.
  • Flag defaults and rationale: setup/config-defaults.md. Runbook: setup/runbooks/secrets-and-audit.md.

Verified

  • Live AWS clusters built from the production Terraform module, including an 8-node role-separated topology (3 server / 1 ingress / 4 worker) with a c5.metal Firecracker worker.
  • Failover (UC-117): the owner was killed, the sandbox was recreated on a recipient, and the credentials were read back inside the guest.
  • Security matrix green live: sealing, fan-out, failover, reseal, env API, audit chain and tamper detection, witness fail-closed, mTLS/authz, enterprise boot gate, storage retirement (UC-110…UC-170).
  • Plaintext leak sweep (UC-169): a canary is found nowhere on any node, in any encoding.
  • Ingress proxy routing, live: 3-node 77 pass / 0 fail; 8-node 125 pass / 0 fail; 0 dropped connections under churn; sessions survive sandboxd restarts.

Known limitations

  • /health does not yet reflect Raft leadership, and there is no /ready endpoint.
  • Audit history is node-local unless an export backend is configured.
  • vault provider: not implemented (fails closed).
  • SB_INGRESS_PROXY_ROUTING stays off by default until a flagship benchmark run.

Full changelog: v0.5.7...v0.6.0 · PR: #374

What's Changed

  • fix(audit): O(page) sandbox audit reads via a per-sandbox index by @sumansaurabh in #402
  • fix(audit): one shared spill writer; worker spills batched off the dial path by @sumansaurabh in #403
  • perf(list): batch failover_ready per page instead of per row by @sumansaurabh in #404
  • perf(audit): boot verifies the chain once, O(1) memory; opt-in checkpoint boot by @sumansaurabh in #405
  • fix(isolate): cluster-wide js-bundle list, lost-node error code, and the workerd jail realized end to end by @sumansaurabh in #406
  • fix(secrets): run the secret lifecycle loop standalone; retire stranded peer obligations (finding #10) by @sumansaurabh in #407
  • fix(audit): retention by record time; redact expired records behind fresh ones in place (finding #11) by @sumansaurabh in #408
  • fix(audit): Emit never waits behind a blocked Sync, EmitDurable or Prune (finding #12) by @sumansaurabh in #409
  • fix(secrets): fail closed on unparsable ingest peer; keep credentials out of replicated mount fields (finding #13) by @sumansaurabh in #410
  • docs(cluster): surface the shard-aware ingress opt-in above 10 ingress nodes; guard Terraform; alert on topology violations (finding #8) by @sumansaurabh in #411
  • fix(audit): per-sandbox egress evidence budget at the writer; workers treat 429 as final (finding #9) by @sumansaurabh in #412
  • refactor(secrets): back off outbox retries via attempts; one sweeper for both peer outboxes (DRY/YAGNI 1-2) by @sumansaurabh in #413
  • test: move coverage_95_* tests next to the source files they exercise (DRY/YAGNI 3) by @sumansaurabh in #414
  • fix(store): migrate legacy plaintext secrets on upgrade by @sumansaurabh in #415
  • fix(ci): unprivileged isolate jail prep and audit test races by @sumansaurabh in #416
  • fix(cluster): constrain failover recreate to secret recipients by @sumansaurabh in #417
  • fix(ci): stop egress spill writer in tests; drop unused SDK query wrappers by @sumansaurabh in #418
  • fix(cluster): harden secret replication auth, ACKs, and replay by @sumansaurabh in #424
  • fix(cluster): isolate tenant catalogues and stop leader reads on secret PUT/delete by @sumansaurabh in #425
  • fix: audit retention, untrusted spill, and List toolbox decrypt by @sumansaurabh in #426
  • fix(cluster,isolate): keep forwarded streams alive and close isolate jail holes by @sumansaurabh in #427
  • fix(test): stop go-race failures in audit prune and template TempDir cleanup by @sumansaurabh in #428
  • fix(test): stop asserting process-global audit sink health gauge by @sumansaurabh in #429
  • fix(secrets): retire stale replicas, bind env, and cache ingress shards by @sumansaurabh in #430
  • fix(secrets,reconcile): ack peer-delete retries, open staged reseals, authenticate spill, sweep containerd orphans by @sumansaurabh in #431
  • fix(wasm,secrets): restore sealed env on recreate retries; stop rejoin re-attempting the whole outbox by @sumansaurabh in #432
  • fix: close every P0 and P1 from the #374 scale/security review by @sumansaurabh in #433
  • fix(cluster,service,api): bound the three fleet-scale read paths by @sumansaurabh in #434
  • fix(service): bound four per-event and per-holder control-plane reads by @sumansaurabh in #435
  • fix(service,cluster): page and fence the secret holder refresh by @sumansaurabh in #436
  • fix(service): fence the audit identity cache to one lifecycle by @sumansaurabh in #437
  • fix(service): filter recipients before the placement batch in both rejoin passes by @sumansaurabh in #439
  • fix(service): lease the egress audit binding instead of reading per event by @sumansaurabh in #442
  • feat(cluster,store,api): terminal storage-retirement protocol for deletion obligations by @sumansaurabh in #446
  • fix(cluster): enforce the replica budget at raft membership admission by @sumansaurabh in #438
  • fix(cluster): retire node metadata caches and schedule capacity peers independently by @sumansaurabh in #443
  • fix(cluster,service): role-gate ingress route work and page the shard read by @sumansaurabh in #440
  • fix(cluster,service): target-only placement and identity-only membership reads by @sumansaurabh in #444
  • fix(cluster): give dedicated workers a failover recreation loop by @sumansaurabh in #441
  • fix(api): drive the template catalogue sweep from the location index by @sumansaurabh in #445
  • fix(deps): bump containerd to v2.3.5 for CVE-2026-53495 by @sumansaurabh in #447
  • test(service): stop the spill-resume assertion racing the sink's own writer by @sumansaurabh in #448
  • fix(cluster,service): close two races the -race job caught by @sumansaurabh in #449
  • test(service): sweep every spill-drain assertion off the writer race by @sumansaurabh in #450
  • fix(service,harness,daytona): sweep isolate orphans, exclude caps, re-expose daytona env by @sumansaurabh in #451
  • fix(cluster,service,store): close the 11 PR #374 revalidation findings by @sumansaurabh in #452
  • test(service): cover the replicated registries' failure paths by @sumansaurabh in #453
  • fix(cluster,service,store): close the 10 round-3 revalidation findings by @sumansaurabh in #454
  • fix(cluster,service): close the 8 round-4 revalidation findings by @sumansaurabh in #455
  • fix(cluster,service): close the 6 round-5 revalidation findings by @sumansaurabh in #456
  • fix(cluster): close the 3 round-6 revalidation findings by @sumansaurabh in #457
  • fix(cluster): close the 2 round-7 capacity findings by @sumansaurabh in #458
  • fix(service,cluster,store): close the 4 round-8 findings plus one more by @sumansaurabh in #460
  • fix(service,wasmmod,store,cluster): bind WASM checkpoints to their lifetime by @sumansaurabh in #461
  • merge: bring main into plans/secrets-hardening (unblock #374) by @sumansaurabh in #474
  • fix(docs): sync lockfile so Cloudflare npm ci can install by @sumansaurabh in #476
  • itest: build daemon artifacts locally (T1-T4) + the three defects the first live run found by @sumansaurabh in #475
  • fix(terraform): bootstrap the CSR signing rendezvous so clusters form again (T5/T6) by @sumansaurabh in #477
  • itest: KMS, audit sinks, the audit receiver, and the security scenario matrix (T7-T10) by @sumansaurabh in #478
  • feat(api): operator-readable cluster-secret holder set (T10b) by @sumansaurabh in #479
  • test(itest): shared secrets/audit/enterprise harness helpers (T11) by @sumansaurabh in #480
  • fix(test): stop a toolboxd stub leaking a listener on the fixed port 2280 by @sumansaurabh in #483
  • test(itest): secrets use-case groups A-D, UC-110..130 (T12) by @sumansaurabh in #481
  • test(itest): non-regression, group M, and the SEC catalogue (T16/T16b/T17) by @sumansaurabh in #486
  • fix(cluster,audit,secrets): seed rejoin + 7 bugs found by T18 hetero-lite; T18/T19 split by @sumansaurabh in #487
  • feat(cluster): draining a node makes its storage-retirement obligation visible (UC-160) by @sumansaurabh in #495
  • fix(service): publish the artifact catalogue before CreateTemplate returns by @sumansaurabh in #496
  • fix(toolboxd): keep an exec child's exit status when the PID-1 reaper wins by @sumansaurabh in #497
  • fix(api): route a template GET through the artifact catalogue when gossip trails by @sumansaurabh in #498
  • itest: DNS-cache + health-wait fixes; Caddy reload connection-loss repro by @sumansaurabh in #499
  • fix(cluster): let a catalogue template holder pass the placement template filter by @sumansaurabh in #500
  • plan(itest): record the S5 metal re-run (#496/#498 proven live) by @sumansaurabh in #501
  • plan: ingress routing without per-sandbox Caddy reloads (eng-reviewed) by @sumansaurabh in #502
  • [stack 1/10] refactor(service): extract shared L4 proxy primitives; zero-copy both directions by @sumansaurabh in #503
  • [stack 2/10] refactor(service): route every per-sandbox Caddy write through publicRouteWriter by @sumansaurabh in #504
  • [stack 3/10] feat(cluster): versioned placement delta feed for ingress Agents by @sumansaurabh in #505
  • [stack 4/10] feat(routedns): route responder + owner/ingress tables for static Caddy routing by @sumansaurabh in #506
  • [stack 5/10] feat(caddy,deploy): static owner/ingress routes, resolver routing, boot probe by @sumansaurabh in #507
  • [stack 6/10] feat(ingressproxy,sdk): host router for the static-route fallback; retry 421 by @sumansaurabh in #508
  • [stack 7/10] feat(daemon): no on-demand TLS on ingress-only nodes under ingress proxy routing by @sumansaurabh in #509
  • [stack 8/10] feat(hostport,service): kernel DNAT forwarding for raw TCP host ports (T7) by @sumansaurabh in #510
  • [stack 9/10] feat(daemon,service,caddy): wire ingress proxy routing; one-load flag on/off (T9) by @sumansaurabh in #511
  • [stack 10/10] itest(routing): churn gate, restart survival, no per-sandbox Caddy routes (T10) by @sumansaurabh in #512
  • fix(docs): record emnapi 1.11.3 so Cloudflare npm ci succeeds by @sumansaurabh in #513
  • docs(todos): UC-160 and the S3 partition are fixed; ingress reload shipped behind the flag by @sumansaurabh in #514
  • feat(secrets): secrets hardening — failover fan-out, env seal, audit, KMS by @sumansaurabh in #374

Full Changelog: v0.5.7...v0.6.0