Repository navigation
Conversation
…irectory A task_started event's session and task ids become path segments under the Claude temp root. path.join normalizes '..', so a malformed or spoofed id could read a file outside the session's tasks directory and stream it to the client as command output. Reject ids that are not plain tokens before the tailer starts; the tool result still carries the final read. Reported in pingdotgg#26489.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e65b3f08a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| stop: yield* Deferred.make<void>(), | ||
| onChunk: (chunk) => Queue.offer(chunks, chunk), | ||
| }).pipe(Effect.forkScoped); | ||
| yield* Effect.sleep("200 millis"); |
There was a problem hiding this comment.
Remove the real-time waits from these tests
Both new traversal tests call Effect.sleep("200 millis") inside it.live, so the configured t3code/no-real-time-wait-in-tests rule reports them and check:changed cannot pass. Coordinate the fiber result with the queue or a deferred instead of using a wall-clock window; the second test repeats this at line 143.
AGENTS.md reference: AGENTS.md:L115-L123
Useful? React with 👍 / 👎.
|
Thanks for this. #36216 makes the same change and is the one being kept. #36216 already rejects the same session and task IDs before output discovery. Its regression covers both traversal cases without the timed waits added here, so it is the smaller equivalent fix to keep. Your report and the need for ID validation still stand; the existing pull request addresses the same underlying problem. Closing as a duplicate. |
Problem
ClaudeTaskOutputTail.locatebuildspath.join(root, project, sessionId, "tasks",${taskId}.output)from thesession_idandtask_idon a providertask_startedmessage. Neither value is validated.path.joinnormalizes.., so a malformed or spoofed id reads a file outside the session directory and streams its contents to the client as command output. Reported in #26489.Change
Reject ids that are not plain tokens (
/^[A-Za-z0-9_-]+$/) before the tailer starts. That pattern admits no..segment, no path separator, and no drive prefix, sopath.joincannot leave the session directory. A rejected id drops the live tail only; the tool result still carries the final read, so nothing else degrades.The guard sits at the entry point rather than inside
locatebecause the pattern already makes a separate containment check unreachable, andlocateis module-private with one caller.Scope
Fixes #26489. One underlying problem, one source file plus its test.
A strict-pattern rejection is smaller and more obviously correct than resolving the path and comparing it against the session root. If maintainers prefer containment as defence in depth, it can be added inside
locatewithout changing the tests.Verification
Two tests in
ClaudeTaskOutputTail.test.ts:does not follow a task id that would leave the session directorywrites a file one level above the session'stasksdirectory and passestaskId: "../leak". Without the change the tailer finds it and offerssecret\n; with the change it offers nothing.does not follow a session id that would leave the project directoryexercises the same shape on the session id.Both fail against the unmodified file and pass with it:
apps/servertypechecks clean (effect-tsgo tsrs --noEmit, exit 0, no findings in the changed file).I did not run the full repository suite. The change is confined to this module and its test file.
Agent: deepseek-v4.1-flash on Capy.