[GH-ISSUE #5778] write/edit through a workspace symlink bypasses sensitive-file staging #3192

Closed
opened 2026-10-21 06:00:24 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @kolacheee on GitHub (Sep 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5778

Originally assigned to: @kolacheee on GitHub.

In one sentence: write/edit decide whether to stage a sensitive-file change from the requested path only, so a workspace-internal symlink pointing at a sensitive file classifies as "normal" and the write applies directly to the sensitive target with no user approval.

The gap

resolveWorkspacePath (workspace-agent.service.ts) computes the canonical (realpath) policy for the target but only enforces it for "forbidden" - the "sensitive" classification is enforced only when requireOrdinaryMutationPath is set, which write/edit do not set - and it returns the requested absolute path. commandWrite/commandEdit then re-derive the staging decision from the requested path: link.json -> package.json reads as "normal", stageSensitiveFileChange is skipped, and writeFile follows the symlink into package.json. Mari can create the symlink herself in sandboxed bash (ln -s package.json link.json writes only the link and isn't classified as mutating).

That bypasses the sensitive-change review floor that even Bypass permissions mode is documented not to lift. copy/move are immune because ordinaryMutationPath checks both requested and canonical policies - write/edit should do the same.

Fix direction

In commandWrite/commandEdit, derive the staging decision from the canonical policy that resolveWorkspacePath already computes (stage when either the requested or the canonical path is sensitive), mirroring the copy/move handling.

Found during the adversarial review for #5775; pre-existing and the inverse direction of #5756 (a change that applies when it should have staged, rather than one that staged being reported as applied).

Originally created by @kolacheee on GitHub (Sep 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5778 Originally assigned to: @kolacheee on GitHub. **In one sentence:** `write`/`edit` decide whether to stage a sensitive-file change from the requested path only, so a workspace-internal symlink pointing at a sensitive file classifies as "normal" and the write applies directly to the sensitive target with no user approval. ## The gap `resolveWorkspacePath` (workspace-agent.service.ts) computes the canonical (realpath) policy for the target but only enforces it for "forbidden" - the "sensitive" classification is enforced only when `requireOrdinaryMutationPath` is set, which `write`/`edit` do not set - and it returns the requested absolute path. `commandWrite`/`commandEdit` then re-derive the staging decision from the requested path: `link.json -> package.json` reads as "normal", `stageSensitiveFileChange` is skipped, and `writeFile` follows the symlink into package.json. Mari can create the symlink herself in sandboxed bash (`ln -s package.json link.json` writes only the link and isn't classified as mutating). That bypasses the sensitive-change review floor that even Bypass permissions mode is documented not to lift. `copy`/`move` are immune because `ordinaryMutationPath` checks both requested and canonical policies - `write`/`edit` should do the same. ## Fix direction In `commandWrite`/`commandEdit`, derive the staging decision from the canonical policy that `resolveWorkspacePath` already computes (stage when either the requested or the canonical path is sensitive), mirroring the copy/move handling. Found during the adversarial review for #5775; pre-existing and the inverse direction of #5756 (a change that applies when it should have staged, rather than one that staged being reported as applied).
bsakaguchi 2026-10-21 06:00:24 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3192
No description provided.