Repository navigation
Backlog
Backlog
Copy link
Description
Goal
MCP clients cannot fill the app log with arbitrarily long strings, and one MCP client cannot read or cancel a task that the app created for another client just by declaring the same client name.
Context
Log
crates/mcp-server/src/tool_server.rs:303-309(run_confirmable_response): logsclient = ?client_nameat info. This is the rawclientInfo.namefromclient_name()(:254-258), beforenormalize_client_name(which trims and cuts to 64 characters,crates/app-logic/src/mcp_sessions.rs:71-78) runs incall_context(:250). A client can send a name of any length and it is logged in full on every call.tool_server.rs:572-575(get_server_notes): logsserver_id = %server_idat info beforeparse_server_id(:577), so any client string is logged unbounded. Inrun_confirmable_responsethe id is parsed first (:300), so only valid UUIDs reach the log there.- The file logger writes JSON (
crates/app-logic/src/logging.rs:300-304), so control characters are escaped; the problem is size, not forged lines. Spec 0094 (no content in default logs) applies.
Tasks
ExtensionSet::answer_as_task(crates/mcp-server/src/extension.rs:563-601) stores the task under the id chosen by the extension (answer.task.task_id) and returns that id to the client unchanged.task_owner(extension.rs:604-624) letstasks/getandtasks/cancel(tool_server.rs:693-717) reach a task when the caller's normalised client name equals the creator's (:619). The client name is self-declared (clientInfo.name); ADR 0109 Decision 2 states it separates workspaces and is not an authorisation. All clients share one token.- So any client that knows or guesses a task id and declares the same name (or no name) can read or cancel that task. The core does not require task ids to be unguessable.
THREAT-MODEL.md:380-384saystasks/getandtasks/cancel"only reach tasks created for the same client", without saying that the client identity is self-declared.
Requirements
- Every info/warn/error log field in
crates/mcp-server/src/tool_server.rsthat carries a client-supplied string logs at most a bounded prefix: the client name is logged in its normalised form (≤ 64 characters), andget_server_noteslogs the server id only afterparse_server_idsucceeded (an invalid id is logged as invalid, without its text). - The core gives MCP clients its own task id instead of the extension's: a random id with at least 122 bits of entropy (UUID v4), generated by the core when it registers the task.
tasks/getandtasks/cancellook up the task by this id and call the extension hooks with the extension's own id, so the extension API (McpExtension) does not change. Every task object the client receives (the answer to the tool call and the result oftasks/get) carries the core's id. - The client-name check in
task_ownerstays as an additional check. - Existing duplicate-id handling, TTL expiry and session-close cleanup keep working with the new mapping.
THREAT-MODEL.md(MCP tasks paragraph) states that the client name is self-declared and that a task is reachable only with its unguessable id; Spec 0028 describes the core-issued task id.
Acceptance Criteria
- A tool call with a
clientInfo.nameof 1 MiB produces log lines whose client field is at most 64 characters (test with a captured tracing subscriber) -
get_server_noteswith a 1 MiBserver_idreturns the invalid-id error and the log line does not contain the id text - The task id returned to the client differs from the id the extension returned and is a UUID v4; two tasks get different ids
-
tasks/getandtasks/cancelwith the returned id reach the extension hook with the extension's own id (test incrates/mcp-server/tests/tasks.rs) -
tasks/get/tasks/cancelwith the extension's own id, or with a returned id from a client with another name, give not-found - TTL expiry and session close remove the mapping (existing tests adapted, still green)
- Without extensions nothing changes
- Relevant automated tests pass
Technical Notes
- Security-critical module (
crates/mcp-server/). No change to the filter engine, the confirmation flow or the token check; MCP origin still forces confirmation. - Spec 0094 A1.6 (tool name only, never arguments) stays as is.
- User-visible as a security change: add a changelog fragment.
Files: crates/mcp-server/src/tool_server.rs, crates/mcp-server/src/extension.rs, crates/mcp-server/src/tool_server/tests.rs, crates/mcp-server/tests/tasks.rs, docs/specs/0028-mcp-server-integration.md, THREAT-MODEL.md, changelog.d/
Spec impact: update 0028
Open questions
- Where to keep the id mapping: (a) replace the map key in
ExtensionSet::tasksby the core id and store the extension's id inTaskOwner, (b) a second map. Recommendation: (a), one map, one lookup.
Related Work
- Contain panics in the MCP task hooks (answer_as_task, task_status, cancel_task) #1659 (also edits
extension.rsand Spec 0028) - MCP extension point: answer tool calls as MCP tasks (protocol revision 2026-07-28) #1633, MCP tasks: honour ttl, test not-found after session close, spec the Completed decision #1660
Metadata
Metadata
Assignees
Type
Fields
Priority
P2 - Normal
Activity