let members use chat
The owner authorized this explicitly. Two refusals removed together, because
they were always one guard in two places: the wholesale isSuperAdmin middleware
in api/chat/chat.ts, and the chat socket's 403 in server.tsx.
They were right for the day they stood. A turn spawned claude as the OWNER and
every transcript path resolved through the owner's home, so a granted member
would have read the owner's sessions and run an agent as them.
What replaced them, rather than what deleted them:
the turn runs as the member spawnClaudeAsMember through sudo setpriv,
proven against a real account by reading file
ownership rather than trusting the process
the credential is theirs --reset-env plus an allowlist, so the owner's
proxy variables cannot cross
the transcripts are theirs ChatIdentity carries a home from resolveHomeDir
and claude-sessions cannot invent one
the sessions are theirs every session records its owner and all six
sidecar commands refuse a mismatch
Also adds the precondition host asked for in 10: a member whose claude is not
signed in gets the instruction rather than a turn that dies on an auth error and
reads as a broken agent. Not installed and not signed in are separate messages
because they need different actions.
registry.ts and registry.test.ts now describe chat as confined in fact rather
than ahead of its implementation. The comments at both former guards say what
had to exist first, and that a revert should go back to a refusal rather than to
a narrower one.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+3
-8
@@ -207,14 +207,9 @@ async function upgradeWs(
|
||||
url.searchParams.delete('osUser');
|
||||
url.searchParams.delete('home');
|
||||
|
||||
// The other half of the temporary chat gap — see api/chat/chat.ts for the whole reasoning. The capability
|
||||
// is grantable so the route resolves, but a turn would spawn `claude` as the OWNER, so the transport is
|
||||
// owner-only until agents run under `runAs`. Refusing the socket is what makes that true rather than
|
||||
// documented.
|
||||
if (provider === 'chat') {
|
||||
const chatUser = await getUserById(user.id);
|
||||
if (chatUser?.role !== 'Super Admin') return new Response('Forbidden', { status: 403 });
|
||||
}
|
||||
// The chat socket's owner-only refusal was removed on 2026-08-12, with `api/chat/chat.ts`'s in the same
|
||||
// commit — they were always one guard in two places. A member's turn now runs as their own Linux account
|
||||
// with their own credential and their own transcripts; the capability check above is what gates it.
|
||||
|
||||
if (provider === 'terminal') {
|
||||
const resolved = await resolveHomeDir(user.id);
|
||||
|
||||
Reference in New Issue
Block a user