Repository navigation
fix(server): Claude task output tail ignores ids that are not a single path segment - #36058
juliusmarminge wants to merge 8 commits into
Conversation
…ersing session ids Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e path segment The tail joined the SDK's task_started session_id and task_id into a filesystem path unchecked, so an id containing `..` could stream a file outside the Claude task directory as command output. Skip tailing unless both ids match `^[\w-]+$`. Fixes #26489 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted; verified with the tests and tools listed above.
AI-assisted; verified with the tests and tools listed above.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — The change rejects malformed SDK IDs before discovering and streaming Claude task-output files. It narrows filesystem access while preserving normal task output and final results, with no material operational or product-policy change. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
The automated pipeline stopped on this pull request and will not merge it: the proof could not be captured: the agent's turn ended as failed twice It stays open for a person to finish or close. |
|
Thanks for this. #36216 makes the same change and is the one being kept. #36216 carries the same ID guard and traversal regression test, and explicitly supersedes this pull request. It preserves your commits, so that successor is the one to keep. Your implementation stands unchanged there. The remaining work is to resolve the outstanding reproduction evidence on that pull request. Closing as a duplicate. |
tailClaudeTaskOutput joins sessionId and taskId from the Claude SDK stream into ///tasks/.output and then reads and streams that file. An id with '..' or '/' could point it at a file outside Claude's task directory (#26489). The fix returns early unless both ids are a single [\w-]+ segment. Real ids (UUID session ids, short alphanumeric task ids) match that. One test covers a traversing sessionId and a traversing taskId, each pointing at a real file outside root. It fails without the guard and passes with it. origin/main merged cleanly into the PR head (merge commit, author commits kept). The diff already followed AGENTS.md, so no code changes were needed. The push to fix/issue-26489 was refused, so the branch is on the fallback name.
Fixes #26489
Supersedes #26501. The change is @juliusmarminge's; their commits are kept.
Reproduction on main
This requires a controlled malformed provider stream; the issue provides no ordinary chat prompt that triggers it. In an isolated real T3 server and client on POSIX, use a Claude SDK stream fixture that emits a Bash tool call followed by its matching local_bash task_started message eligible for live tailing, with session_id '../../outside' and a valid task_id. Create a project directory under the configured Claude task-output root and place a harmless marker in outside/tasks/<task_id>.output beside that root. Start the fixture-backed Claude turn and inspect the command's live output: main streams the marker, while this change omits it. Repeat with a valid session ID and task_id '../../../../outside/tasks/<task_id>'; confirm a normal final tool result still arrives. These steps were derived from the issue, diff, and adapter code, not executed.
Evidence
Being captured: before and after in the real app. This section is filled in before the pull request can merge.
Tests
vp test run src/orchestration-v2/Adapters/ClaudeTaskOutputTail.test.ts: 6/6 pass, and with the guard line removed the new test fails (1 failed, 5 passed). vp run check:changed: format, lint, knip, graphql, typecheck (3 packages) and tests (2 files) all pass.
Not in this change
Who did the work
Run by the t3code factory in T3 Code.