Skip to content

fix(agent/agentproc): enforce chat ID isolation on output and signal endpoints#23316

Merged
mafredri merged 1 commit into
mainfrom
mafredri/fix-process-chat-id-isolation
Mar 20, 2026
Merged

fix(agent/agentproc): enforce chat ID isolation on output and signal endpoints#23316
mafredri merged 1 commit into
mainfrom
mafredri/fix-process-chat-id-isolation

Conversation

@mafredri

@mafredri mafredri commented Mar 19, 2026

Copy link
Copy Markdown
Member

🤖 mafredri sent me to lock the doors between chat sessions.

The process output and signal endpoints did not check the X-Coder-Chat-ID header, so any chat session could read output from or signal processes started by a different chat. This is a correctness issue, not a security boundary (the agent trusts all callers equally), but it breaks the isolation model that chatd relies on.

Adds chat ID checks to handleProcessOutput and handleSignalProcess. If the request carries a chat context and the process belongs to a different chat, the endpoint returns 404. Requests without a chat header still work (backwards compatible).

Test: ChatIDEnforcement subtest starts a process under chat-a, verifies chat-b gets 404, and verifies a headerless request gets 200.

🤖 This PR was created with the help of Coder Agents, and has been reviewed by a human. 🏂🏻

…endpoints

handleProcessOutput and handleSignalProcess did not check the
chat ID from the request. Any caller that knew a process ID
could read output or signal processes belonging to other chats.

handleListProcesses already filtered by chat ID. Apply the
same check to the output and signal handlers. Non-chat callers
(no Coder-Chat-Id header) are allowed through for backwards
compatibility.
@mafredri mafredri marked this pull request as ready for review March 20, 2026 09:24
@mafredri mafredri merged commit 6edcbdb into main Mar 20, 2026
33 checks passed
@mafredri mafredri deleted the mafredri/fix-process-chat-id-isolation branch March 20, 2026 09:24
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants