Repository navigation
docs(docs): The text of the spec Run grant workers in a filter sandbox on hosts without namespaces is in git - #59
Merged
Merged
Conversation
…x on hosts without namespaces is in git The accepted export of #21, as export-spec.py wrote it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #21
Summary
The text of the spec "Run grant workers in a filter sandbox on hosts without namespaces" is in the repository at
docs/specs/E1-21-run-grant-workers-in-a-filter-sandbox-on-hosts-without-names.md, as the issue held it when the spec closed. Nothing changes for anyone using the product.Before this closing, each of the spec's 41 user stories was mapped to the test, static check or live run that proves it (the table under Evidence). On
d5b15ba, four stories (8, 9, 30 and 33) held but were only partly tested: code broken on purpose still passed every test. #57 added their guards, building #56, a sub-issue of this spec that is now done. One clause stays unmeasured: story 30's "so that throughput is unchanged", which no seam in the spec's Testing Decisions measures and #56 put out of scope.The verification also filed #58, a flaky Electron GPU crash in the Companion end-to-end run, with no milestone, so it does not hold this spec open. It also ticked #24's last criterion, which asked for a comment on #18; that is moot, because the reporter qualified and #18 is closed.
Evidence
export-spec.py 21export-spec.py 21same-as-issue.pyNo test or guard is new here: the four guards #57 added were each shown red there against code broken on purpose, and green against the real code.
python3 .claude/plugins/foresight/scripts/export-spec.py 21, run after #57 merged:wrote … as accepted: every sub-issue is closed and only specs are open in E1 Run grant workers in a filter sandbox on hosts without namespaces, so the pull request that adds this file closes #21. The sub-issues are #22, #23, #24, #25 and #56, all closed. A comparison of the file's text after its header withgh issue view 21 --json body, CRLF read as LF:#21: 18201 bytes after the header, 18201 in the issue's body, the same.The 41 user stories of #21: 28 Test, 8 Static, 7 Live run (stories 10 and 11 are both Test and Live run), 0 Partial, 0 Gap
Unless a row says otherwise, "CI" means the run at
d5b15ba: Sidecar mTLS 45512063905 (jobscurl,gateway-arm64,gateway-filter-sandboxon x86-64 and arm64) and CI 45512063655 (workspace). All of them passed.worker_sandbox.rsiscrates/countersign-gateway/tests/worker_sandbox.rs, the containment test (seam 2).runtime.pyiscrates/countersign-gateway/tests/runtime.py, the real Gateway end to end (seam 1). The script isscripts/filter-sandbox-container.sh."filter"lets the Gateway start== Qualified. The reporter's run on x86-64 (#18 comment).gateway-filter-sandboxjob runs the same under Docker's default profile.runtime.pywithout--worker-sandboxwrites noworker_sandboxfield and asserts the startup lineGateway worker sandbox "namespaces": namespaces, non-dumpable, Landlock …, seccomp allow-list. CIcurl,gateway-arm64.runtime.pyconfiguration_loading:for value in ('seccomp', 'Filter', 'none', '', None, True, ['filter']): assert not loads(worker_sandbox=value)runtime.pystartup_failure:assert result.returncode != 0, 'The Gateway started under a worker sandbox this host was expected to refuse'. Step 4 runs"namespaces"where namespaces are refused; step 5 runs"filter"where the allow-list is refused, in an image that has bubblewrap."namespaces"routed to the direct launch, the Gateway started (TimeoutExpired).worker_sandbox.rsthe_grant_worker_is_confined_before_it_is_sent_anythingruns the Gateway's own grant worker and probes it.startup_failure:re.fullmatch(rf'worker sandbox "{sandbox}" failed: {re.escape(layer)}: \S.*', lines[0]). CI logsworker sandbox "namespaces" failed: namespaces: bwrap: …andworker sandbox "filter" failed: seccomp allow-list: ….namespacesandseccomp allow-list.Landlockis named at seam 2 bya_layer_the_host_refuses_fails_confinement_by_name. No test drivesnon-dumpableorlaunch.startup_failure:assert 'operate/#choose-a-worker-sandbox' in lines[1]andassert f'"{other}"' not in result.stderrruntime/worker.rs) to the heading indocs/operate.md. Renaming the heading would leave a dead link with every check green.runtime.py:assert wait_for_log(… r'Landlock (ABI v[1-9]\d*|unavailable), seccomp allow-list'). For "unavailable": the script's step== The filter sandbox starts on a kernel without Landlockrunsruntime.py --worker-sandbox filter --landlock unavailable, which pins the line toGateway worker sandbox "filter": non-dumpable, Landlock unavailable, seccomp allow-list.ef3891e), afterd5b15ba. Every CI host has Landlock; the step refuseslandlock_create_rulesetwithENOSYS, using the script'srefusingprofile.without_landlock_it_says_so_and_is_still_confinedanda_host_that_denies_landlock_is_reported_as_without_it_and_still_confined.ef3891e). It fails when the supervisor rejects a probe that reports no Landlock:worker sandbox "filter" failed: launch: the probe grant worker reported no layers. The real code passes.runtime.py --worker-sandbox filter, shared pass, ingateway-filter-sandbox: three grant workers serve concurrently, and'Alice cutoff affected Bob',"Alice's killed grant worker affected Bob". Seam 2 refuses cross-worker memory reads and signals (rows 21 and 24). Fargate: the harness's shared pass, and the reporter's two concurrent grants.sidecar Gateway mTLS passedunder"filter"ingateway-filter-sandbox(x86-64, arm64) and in the Fargate harness run.docker run --user "$(id -u):$(id -g)"with no added capability. CI runsruntime.pyunder bubblewrap as the runner's user, withoutsudo. The Fargate tasks loggeduid / gid: 65531 / 65531with no capabilities./usr/bin/bwrapif inside filter test -e /usr/bin/bwrap; then … exit 1, then the runtime test under"filter"in that image.runtime.pylaunched_directlyasserts that every grant worker's parent is the Gateway and that itsName:iscountersign-gat.qualify.sh).docs/operate.md, "Choose a worker sandbox": "The filter sandbox gives up the namespace layer: a grant worker shares the supervisor's filesystem, process table and network stack …"d5b15ba.mkdocs build --strictguards the anchor only, not the wording.worker_sandboxand both valuesdocs/reference/config.md, theworker_sandboxrow: default"namespaces", both values, "Any other value fails loading".d5b15ba.docs/operate.md, the row "Gateway exits withworker sandbox "<sandbox>" failed: …", under"namespaces","filter"and either.d5b15ba.runtime.pyfilter-kill pass, under both sandboxes:wait_for_log(r"Gateway grant alice: grant worker killed by the worker sandbox's filter \(SIGSYS\); grant fenced")SIGSYSitself, since the supervisor cannot tell that from a filter kill. Seam 2 shows that the filter's kill isSIGSYS(row 25). PR #26 showed it red under bubblewrap's exit code 159.assert request('alice').returncode != 0, 'A grant whose worker the filter killed was served again', then'A fresh approval did not restore service'with a new grantopening_a_file_is_refused(open /, unconfined control gets through)reading_the_supervisors_environment_is_refused(open /proc/<supervisor>/environ) andreading_the_supervisors_memory_is_refused(process_vm_readv)filter_sandbox_launch_passes_on_no_descriptor_and_no_environmentshows the launch passes on no environment.reading_the_other_grant_workers_memory_is_refused, andan_unconfined_process_cannot_read_a_grant_workers_memory:Outcome::Errno(libc::EPERM)a_tcp_connection_is_refused,a_udp_datagram_is_refused(each with an unconfined control that gets through)running_a_program_is_refused(execv /bin/true), plusstarting_another_process_is_refused(fork) andstarting_another_process_by_clone3_fails_as_unsupportedsignalling_another_process_is_refused:killto the other stand-in, the supervisor and its own process group.having_the_kernel_signal_another_process_is_refused(F_SETOWN).signalling_itself_works:Outcome::Killed(libc::SIGTERM)on itself, with the other unharmed.tgkillto another process is not tried.tkillandpidfd_send_signalare covered only by the general kill of off-list calls (row 25).a_forbidden_system_call_kills_it_with_sigsys:*o == Outcome::Killed(libc::SIGSYS)forptrace(PTRACE_TRACEME)a_system_call_in_the_x32_range_kills_itanda_system_call_from_a_foreign_architecture_kills_it(int 0x80) ran, not skipped, inworkspace (ubuntu-latest),gateway-filter-sandbox (ubuntu-24.04)and on Fargate x86-64.docs/adr/0001-filter-sandbox-for-hosts-without-namespaces.md,status: accepted: "define it as the equivalent OS sandbox for hosts that cannot create namespaces", with the base layers in decision 1d5b15ba.runtime.pydefault sandbox asserts"namespaces": namespaces, non-dumpable, Landlock …, seccomp allow-list, which the probe worker reports from inside bubblewrap. CIcurl,gateway-arm64.SCM_RIGHTSafter confinementworker_sandbox.rstakes its stream byrecvmsgafterconfine():assert_eq!(words[0], "ready", "the stand-in never served its stream"). Everyruntime.pyrequest passes three streams to a confined grant worker (ChildHandle::attach).runtime.py: two requests by one user, so to one grant worker, held at the site's/togetherbarrier until both arrive:assert all(res.returncode == 0 for res in both). Every pass, both sandboxes.ef3891e). It fails when the grant worker serves one connection at a time (curl: (56),curl: (35)). "Throughput is unchanged" is not measured: Testing Decisions names no seam that could measure it.gateway-filter-sandbox(x86-64, arm64). The script fails when the container can create namespaces:'This container can create namespaces, so it proves nothing about the filter sandbox.'curl(x86-64) andgateway-arm64runruntime.pywith the default sandbox and logGateway worker sandbox "namespaces": namespaces, ….runtime.pyor the startup probe; PR #26 showed it red without theclonerule. For the lazy path that Further Notes names,worker_sandbox.rsa_panic_unwinds_and_the_grant_worker_lives_onhas each stand-in's first panic unwind after confinement, and expects a reply.ef3891e). Withwriteremoved from the allow-list (a panic writes its message), it fails withstand-in 0, `panic`: expected a reply, got Killed(31). This still guards only the paths the tests drive.worker_sandbox.rs:use countersign_gateway::worker_sandbox::confine;. Each stand-in callsconfine(), and each property has its own named test.each_of_twostarts two stand-ins, aims each attempt at the other, and asserts"stand-in {attacker}'s{command}harmed the other stand-in"after each.GLOSSARY.md, "Gateway isolation": all four termsd5b15ba.worker_sandbox: "filter". Two grants held open at the site's barrier, 1.398 s apart.docs/specs/2026-11-17-countersign-design.md: "one of two worker sandboxes, chosen by the operator: the namespace sandbox … or the filter sandbox …"d5b15ba.qualification/fargate/. Its run at30bedc2(#24 comment): containment test 25/0 on x86-64 and 23/0 on arm64, runtime test passed on both, kernel 6.1.190, Landlock ABI v2.30bedc2andd5b15ba,worker_sandbox.rsandruntime/worker.rsare unchanged,runtime/mod.rschanges only on the supervisor's side, andCargo.lockchanges only versions.qualification/fargate/run.sh localatd5b15ba, in this verification (arm64, Docker's default profile): exit 0, containment 23/0, everyruntime.pypass including the egress-proxy ones,== Qualified.docs/develop.md: "Run it for every release that touches the grant worker."30bedc2(row 40).Not run: nothing.
mkdocs.ymlexcludes/specs/from the site, so no documentation build reads the file.Merge Danger
Door: two-way. A revert removes the file, and #21 is reopened by hand.
Blast Radius: none.
The merge ships no image, release or infrastructure, and no flag.
Reviews
No review ran: the file is the issue's text, checked byte for byte
Tracking
Epic: E1 Run grant workers in a filter sandbox on hosts without namespaces
Spec: #21 Run grant workers in a filter sandbox on hosts without namespaces
Ticket: none
Flag: none
🤖 Generated with Claude Code