Repository navigation
org: websocket origin check, bots stay in scope, and the hosted limits written down - #2913
Merged
Merged
Conversation
…cess
DELETE /v1/people/{handle}/sessions ended sign-ins and bots, but a hosted chat
holds a minted bearer of its own, valid for seven days. A removed person's chat
kept spending the organization's model key and reaching git as them, and their
stored provider keys and chats stayed behind.
Removal now ends those bearers first, in this process, then forgets the
person's sealed keys, then deletes their chats on the chats' host. A registry
row is forgotten only once the host confirms the delete (or answers that the
chat is not there); a host that is down never blocks the removal. The
revoke-link loop does the same for the people it removes.
Found by the hostile-client round (a bearer replayed after its owner was
removed still got a 200 from the model door).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…next attach finishWire cancelled the finished connection before taking the lock that removes it from the chat's group. For as long as it waited for that lock the connection was "cancelled and still in the group", which reserveWire reads as "the chat is being stopped", so a reconnect in that window got 503 "This chat is unavailable right now." (a guest saw "The place chats run on is not answering."). The cancel now runs after the removal. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
/tmp, /dev/shm and /var/tmp are writable by every chat by design, and the reap helper cleared only the chat's own folder. After the 24 hour quarantine a new chat on the same Linux user found the old chat's files, FIFOs, shared memory, message queues and semaphores, owned by "itself". Every mode of the reap helper (clear on delete, tmp on stop, init on start) now also removes, as the chat's own user and without following links, everything that user owns in those three areas and every System V segment, semaphore set and message queue it owns or created. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Rows of GET /v1/hosted/sessions carry `verbs` since 527bf1f, and the smoke test still asserted the old key set. A shared row now asserts the verbs ['view'], the operator's metadata-only row asserts none. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… to everyone When the operator removed a person while the chats' host was down, the person's chats were not listed, so their registry rows and shares stayed, and a guest holding edit could still attach and wake one. Waking a chat mints a fresh model bearer for its owner, which is the access the removal had just ended. Every chat the registry still holds for a removed person now has its shares ended and is made private, so every door answers "There is no such chat." The row stays, so the chat is still tracked and removing the person again once the host answers deletes it. The host calls also stop after the first transport error, so a hung host does not make a removal wait once per chat. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… leftovers are cleared Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A WebSocket is exempt from the browser's same-origin policy, so a hostile page could open the hosted chat wire as a person whose sign-in cookie the browser sends. The cookie is SameSite=Strict, which does not cover a page on a sibling name of the same site. Any request that upgrades the connection and carries an Origin other than this server's own (the host it was sent to, or the host of its public address) now answers 403 with one plain sentence, before a credential is read. No Origin is accepted: the command line and the desktop app's engine send none, and no client needs an allowed list. Two existing tests sent a foreign Origin only as a stand-in for hostile headers; they now send the server's own. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A bot narrowed to view could still POST /v1/hosted/sessions and make a chat it could only watch. Starting a chat now asks what the bot would hold on the chat it would own (its creator's verbs narrowed by its scope and the policy's agent scope) and refuses a bot without run, before anything is minted or made. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ta address The port fence cannot stop a chat reaching 169.254.169.254:80, so the operator is told. At start the supervisor connects (and sends nothing) to the AWS, Google and Azure metadata address, AWS's task-credentials address and AWS's IPv6 metadata address, in the background, and logs one warning line naming any that answer. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e test round corrected Corrects the busy sentence (four calls in flight is the limit for a priced model; a model with no price holds half the limit per call), the end of a chat's access on removal of the person, what stop, delete and start clear in the shared areas, and the reap sweep. Writes the v1 limits down in the operator README, the trust model and the manual: the port fence filters by port and not address (with guardrails for the metadata address), no per-chat disk or memory quota, a removal while the chats' machine is down, the seccomp dependency, and the paths not tested end to end (a front proxy, a priced model). Documents the websocket origin check and the run requirement for a bot starting a chat. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
TestHostedRowVerbsOfABotAreItsScope used a view bot to start the chat whose row verbs it then checked. A view bot can no longer start a chat (it needs run), so the chat is started by an edit bot, whose own answer must be its scope alone (run and what rides with it, never share or manage), and the view bot's rows are read from it as before. The contract (a bot's rows hold what its person holds, narrowed by its scope) is unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Open calls for the owner:
|
AbirAbbas
added a commit
that referenced
this pull request
Nov 25, 2026
…ack (#2903) The hosted organisation line: a team-mode org server deciding every request through one access model (verbs, roles, grants and policy in SQLite), hosted chats run by the sessionhost under a per-chat uid inside a Landlock fence with minted model bearers, sealed keys and a git helper, shared chats acting through verbs, bots owned by their creator, the Hosting and chats policy settings, and a self-hosting stack (deploy/org Docker Compose, published images behind a leak gate, a Railway path). Consolidates #2894 #2895 #2896 #2898 #2899 #2900 and the follow-ups #2904 #2905 #2907 #2908 #2910 #2911 #2912 #2913 #2915 #2916 #2918 #2927 #2936 #2944. Proven by the full suite, a keyless Compose smoke, a hostile wire client, sandbox escape probes, a real-model run and a production-style install from the published images. Co-Authored-By: Santosh kumar <29346072+santoshkumarradha@users.noreply.github.com> Co-Authored-By: ZeroPoint95 <329227198+ZeroPoint95@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-ups from the server-side test round of the hosted organization line. Based on #2912's branch (
org/test-round), so its commits show in this diff until #2912 lands inorg/main; this PR's own commits are the four on top, and I will mergeorg/mainin when #2912 lands.What changed
/v1/hosted/sessions/<id>/wire, owner path and guest path). It authenticates with a bearer header or theSameSite=Strictsign-in cookie, never a query token. The command line and the desktop app's engine (codeaf app, same dialer) send noOrigin; the desk webview opens no websocket to the organization server (it goes through the engine). So any upgrade that carries anOriginother than the server's own (the host the request was sent to, or the host of its public address) now answers403 This page is from another site, so it cannot open a chat connection here., before a credential is read. NoOriginis accepted. There is no allowed-origins setting because no client needs one. The event streams are plain GETs whose answers another site's page cannot read (no CORS headers), so they are not upgrades and not changed.runcannot start a chat.POST /v1/hosted/sessionsas a bot now asks what the bot would hold on the chat it would own (creator's verbs, narrowed by scope and by the policy's agent scope) and answers403 This bot's scope does not let it run chats, so it cannot start one. Ask the person who made it.without minting or making anything.docs/organizations.md(trust model) and the manual: the port fence filters by port, not address (the metadata address, with guardrails), no per-chat disk or memory quota, a removal while the chats' machine is down, the seccomp dependency, and a front proxy and a priced model not tested end to end.Validation contract
runout (or whose policy scope does) is refused with the server's sentence and no chat is made; a bot withrunwithin its scope still starts one, owned by its creator.Tests
upgrade_origin_test.go,hosted_bot_start_test.go,internal/sessionhost/metadata_test.go, six new probes ininternal/manual/chat_test.go. Run with the fixes disabled, the origin and bot tests fail.TestHostedRowVerbsOfABotAreItsScopeused a view bot to start the chat it then read; a view bot can no longer start one, so an edit bot starts it and the view bot's rows are read from it (same contract, new vehicle; found by CI on the first push).Gates:
make test-focusoninternal/factory/serve,internal/sessionhost,internal/manual;make pr-ready BASE=origin/org/mainonce: light gate and the touchedserve,manual,sessionhostlegs passed locally, and itscmd/codeafleg timed out at 15 minutes in three shards because the box was at load 15 from other lanes (no test failed). CI at the head: light gate, touched codeaf (17m), touched rest, windows native tests, check and the CLA all pass.Open calls
In the PR comment.
🤖 Generated with Claude Code