Skip to content

Confine output paths: honor MCP roots (or SCREENCAST_ALLOWED_DIRS) and resolve relative paths under SCREENCAST_HOME #221

Closed

Description

@TMHSDigital

Why it matters

This is hardening for a tool that writes files based on arguments chosen by the agent. Relative paths currently resolve against the server's cwd, which for desktop clients is unpredictable (often the client's install dir or System32). Absolute output paths are accepted anywhere the user can write. MCP clients already pass roots to say where a server should operate.

Evidence

resolveOutput in src/utils/paths.ts resolve()s relative paths against process.cwd() and accepts any absolute path (overwriting needs overwrite: true). Nothing reads client roots.

Suggested approach

  • Resolve relative outputs under SCREENCAST_HOME/edits (or the first client root).
  • Read client roots when available, and optionally SCREENCAST_ALLOWED_DIRS.
  • Reject outputs outside the allowed set, with a clear error.
  • Apply the same allowlist to inputs where practical.
  • Document the behavior.

Done when

  • Relative outputs land in a predictable dir.
  • Outputs outside the allowed roots are rejected when roots are known (tests).

Activity

  1. added
    enhancement
    security
    effort: small
    impact: medium
    on Oct 25, 2026
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

    effort: smallenhancementimpact: mediumpriority: mediumsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions