Skip to content

[Bug]: Claude background-task output tail reads filesystem paths built from unvalidated provider stream ids #26489

Open

Description

@IzonIcy

apps/server/src/orchestration-v2/Adapters/ClaudeTaskOutputTail.ts (~27-47), called from ClaudeAdapterV2.ts (~8570-8590), builds:

path.join(input.root, project, input.sessionId, "tasks", `${input.taskId}.output`)

session_id and task_id come straight from the provider stream (SDKTaskStartedMessage, typed as bare string), with no validation before use as path components. path.join normalizes .., so a malformed or spoofed value can escape the session directory, and matched content is streamed to the client as command_output.delta.

The required .output suffix and tasks/ segment narrow the exposure, but the server should not do filesystem reads on provider-supplied path segments.

Expected: reject ids not matching a strict pattern (e.g. /^[\w-]+$/) and verify containment of the resolved path under the session root, as CheckpointRestoreSafety already does for checkpoints.

I plan to submit a focused fix (id validation + containment check with tests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions