Skip to content

[Bubblewrap/LXC/WSLC] protect files that run later inside writable grants #1445

Open

Description

Description of the new feature / enhancement

A script that may write a project folder can plant files that run later, outside the sandbox, as the user: .git/hooks/* and .git/config, .vscode/ and .idea/ task and settings files, shell start-up files (.bashrc, .profile, ...), .mcp.json and agent command folders. A read-write bind does not stop this. The docs already warn that dotfiles in HOME are read as configuration when HOME is the working directory; this is the same hazard for the grant itself.

Proposed technical implementation details

  • For each readwritePaths grant, lay a fixed list of those paths read-only over the existing entries (--ro-bind-try of the path onto itself), including nested ones found by a depth-limited search.
  • For a top-level name that does not exist yet, bind a placeholder (/dev/null for a file, a read-only tmpfs for a folder) and remove it after the run.
  • Add one line to a failed run's result naming the rule that blocked the write.
  • Either a default list with an opt-out, or an explicit protectedPaths field; whichever fits the schema better.

Acceptance criteria:

  • A script cannot create or change .git/hooks/pre-commit, .git/config, .vscode/tasks.json or .bashrc in a read-write grant, and can change an ordinary file next to them.
  • Placeholders are cleaned up after the run, including after a crash.

Known limits we would document: a protected name that does not exist and is nested deeper than the search is not prevented; symlinks inside the grant need care.

We have this in another bubblewrap-based sandbox and can contribute a PR.

Activity

  1. kenchris commented on Oct 7, 2026

    @kenchris
    Author

    A clarification on the description after running the Windows ProcessContainer and WSLC backends with a local build:

    • Explicit readonlyPaths carve-outs inside a readwritePaths grant are enforced. With .git/hooks and .git/config listed read-only inside a writable folder, writes to them were refused (WSLC: "Read-only file system") while ordinary files stayed writable. So "a read-write bind does not stop this" is true only for a plain grant; the capability exists.
    • What is still missing, and what this issue is really about:
      1. A default list of the names that run later outside the sandbox (hooks, IDE task files, start-up files, agent command folders), so every embedder does not have to rediscover it.
      2. Names that do not exist yet. A read-only entry for .vscode/tasks.json that does not exist produced only a warning ("the backend may fail at mount time"), and the contained script then created the file. A placeholder (file bound from /dev/null, folder as a read-only tmpfs) closes that.
      3. An explanation when a write is blocked by such a rule, so the caller and the model can see why.

    We did not test the Bubblewrap backend (no Linux host); that part is from reading the sources. Sorry for overstating the first point in the description.

  2. added
    Issue-BugSomething is not working as intended.
    Priority2High-impact issue affecting key functionality; prioritize for the next appropriate release.
    Priority1Critical customer, security, or reliability impact requiring immediate attention.
    and removed
    Issue-FeatureA request for new or expanded product functionality.
    Priority2High-impact issue affecting key functionality; prioritize for the next appropriate release.
    on Oct 9, 2026
  3. changed the title [-]Bubblewrap: protect files that run later inside writable grants[/-] [+][Bubblewrap/LXC/WSLC] protect files that run later inside writable grants[/+] on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-BugSomething is not working as intended.Priority1Critical customer, security, or reliability impact requiring immediate attention.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions