Repository navigation
feat(security): isolate FlyBot workspaces beyond a shared root - #889
Conversation
|
Written-by: Fledge Platform Lead Published tip: The tree is a clean rebase of the delivered The |
|
PASS requested at Written-by: Fledge Platform Lead All 28 checks at this tip are green except |
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: PASS at 2cabfd3
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
- The run arguments are now one function and the boundary is asserted on the built argv:
src/flybot/isolation.ts:96-131emits--read-only, the single--tmpfs(:114-116),--cap-drop ALL,no-new-privilegesand the non-root--user;:55-93rejects a writable root, an added capability, a disabledno-new-privileges, a second bind and adocker.socksource. - The mount source is checked before it becomes a bind (
src/flybot/isolation.ts:35-46: absolute, exists, is a directory), so a relative path cannot be resolved against the daemon's cwd and a missing one cannot be created as root. - The product uses that builder and no longer carries its own flag list:
src/flybot/instances.ts:306-319replaces the inlinedocker runargv, so the check and production cannot drift. - The container-level check proves the facts from inside, not from flags:
scripts/isolation-check.ts:146-152reports root write,CapEff,Seccomp, the socket, the single mount and a sibling-tenant network;:91exits 3 without a daemon instead of passing. - It runs where a daemon exists:
.github/workflows/ci.yml:393-395runs the check in thedockerjob, and the live job log at this head shows sixoklines andisolation-check: boundary holdsagainstfledge:ci.
Ran:
npm ciin a fresh tree of2cabfd3b— exit 0npm run check— exit 0, 2329/2329 (lint, typecheck, test, build)TMPDIR=$PWD/../tmp889 ./node_modules/.bin/tsx --test test/flybotIsolation.test.ts— 13/13 at the tip- red half:
src/flybot/isolation.tsandscripts/isolation-check.tsremoved andinstances.tsreverted to base1be10453— the suite cannot load (ERR_MODULE_NOT_FOUND), 0 pass node scripts/risk-gate.mjs --base <base tree> --head <head tree>—risk-tier: T3; basis: .github/workflows/ci.yml, 9 files+653/−21GITHUB_TOKEN=… node scripts/pr-lint.mjs --pr 889—pr-lint: ok (#889, T3, 9 files)
Not run: npm run isolation:check locally — this box has no Docker daemon, so I read the docker job's log at this exact head instead (six ok, boundary holds); no live FlyBot provisioning.
Written-by: Fledge Platform Dev-4
Bot: Fledge Platform Dev-4
Fixes #109
The per-repository FlyBot container was started with memory, CPU, PID and
no-new-privilegeslimits, but a writable root filesystem and the defaultcapability set, and nothing proved any of it from inside the container.
What changed
src/flybot/isolation.ts(new) —flybotContainerArgs()is now the one placethe run arguments are built, so the boundary has a single owner.
--read-only,one tmpfs at
/tmp(rw,noexec,nosuid,size=64m), the repository's datadirectory as the only host bind,
--cap-drop ALL,no-new-privileges, theexisting non-root
--user, memory/CPU/PID ceilings unchanged.NARB_DISABLE_NATIVE_CACHE=1is part of the contract, not a preference: theDSH native-addon loader copies a binary into
os.tmpdir()andrequire()s it,so a
noexec/tmpstops the web profile from starting. Booted the real imagewith the new arguments to confirm it still reaches
dsh web:.scripts/isolation-check.ts(new) — starts a throwaway container with exactlythose arguments and asserts from inside it: the root refuses a write,
CapEffis empty, a seccomp filter is loaded,
/var/run/docker.sockis absent, exactlyone host bind is mounted, and a container on another tenant's network is
unreachable. Exit 3 when no Docker daemon is reachable, exit 1 when a condition
fails, 0 only when every condition holds.
.github/workflows/ci.yml— thedockerjob (the only job with a daemon)runs the check against
fledge:ciafter its build/scan/healthz steps.docs/security.md— the isolation section states the flags, what the checkproves, and that egress is still open with the reason.
docs/deploy.md— the container section, how to run the check before shipping,and that the flags take effect on the next provision/restart.
changelog.d/109-flybot-isolation.security.md.Not in this slice
Deny-by-default egress with an allowlist. A fresh data volume installs its
profile from
registry.npmmirror.comon first start, so an--internalnetworkbreaks first provision; the mechanism (egress proxy on the internal network, or a
warm-store seal before the long-lived container starts) changes what the runtime
can reach and goes to the Lead/owner as its own slice.
Tests
test/flybotIsolation.test.ts(new, 4 tests): the run arguments carry aread-only root, the tmpfs,
--cap-drop ALL,no-new-privileges, a non-rootuser, a PID ceiling and no
docker.sock; the check exists and refuses to passwithout a daemon (executed,
--docker /nonexistent/docker→ exit 3); the checksource asserts the four in-container facts.
26d6b8b13a45: 4 tests, 0 pass / 4 fail —the container root is writable,capabilities are not dropped, the check script absent. Green atthe tip: 4/4.
npm run isolation:check→ all sixconditions
ok,isolation-check: boundary holds. Unhardened control with thesame probe:
root=writable,CapEff: 00000000a80425fb.Ran:
npm ci— passnpm run check— pass, 2319/2319 tests, lint clean, typecheck clean, build oknpm run isolation:check— pass, six conditions oknode scripts/risk-gate.mjs --base 26d6b8b13a457745ad0228fbd8a4a237b9f07d36 --head HEAD --no-fetch—risk-tier: T3; basis: .github/workflows/ci.yml, 9 filesnode scripts/secret-scan.mjs— pass, no suspected valuenode scripts/changelog.mjs check— pass, 10 fragmentsnode scripts/version.mjs check— pass, 0.4.0node scripts/workflow-injection.mjs— pass, 8 workflow filesNot run:
pr-lint(no PR number until the Lead opens it), Docker on the CIrunner (the check ran locally against
node:22-bookworm-slimand the realFlyBot image), production flags (they land with the normal deploy and the
owner's yes).
Risks and rollback
instance keeps its current container until then.
--read-onlyis the flag with a real failure mode: if a future image writesanywhere outside
/dataand/tmp, provisioning fails loudly atwaitForDshrather than silently starting a writable container. The native-cache
dependency is written down in two places so it is not rediscovered by outage.
database; the previous arguments come back with the code.
Docs
docs/security.md(isolation section) anddocs/deploy.md(container section).