Skip to content

(sandbox): refuse a newline in any form of a missing control path #1031

Closed

Description

@devsuitup

Follow-up to #1024 (#1022 slice A).

control_path_forms in scripts/claude-sandbox.sh (around :418-423) checks for a newline or CR only in the real path readlink -e returns. That path is empty when the control directory does not exist yet. The other forms are then split line by line (while read ... <<<"$forms", around :492-495), so a form that goes through a directory whose name contains a newline is split into pieces. None of the pieces matches a writable root, and control_visible misses the overlap.

Scenario: CONTROL_DIR=/x/link/triggers, /x/link -> "/a\nb", "/a\nb" is a project mount, and triggers does not exist yet. The "missing visible control path" refusal does not fire.

This cannot happen through Switchboard itself, because main.js creates <triggers>/processed before every sandboxed launch. It can happen when the wrapper is run by hand. Before #1024, a blanket refusal of any newline mount covered it.

Fix: refuse when the requested path, or its readlink -m form, contains a newline or CR. Add a Linux fake-bwrap case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions