Skip to content

Return canonical realpath from workspace containment allow - #516

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-6712-return-canonical-paths-from-workspace-containment-allows
Aug 22, 2026
Merged

Return canonical realpath from workspace containment allow#516
TheGreatAxios merged 2 commits into
mainfrom
cl-6712-return-canonical-paths-from-workspace-containment-allows

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

resolveWorkspacePath already realpath's each candidate to decide containment but returned the lexical (symlink-intact) path to callers, leaving a TOCTOU window: a symlink that is in-bounds at allow time could be retargeted before the actual write/read, escaping the workspace. It now returns the canonical real path so pathEscapePlugin substitutes it into the tool call's path argument before write_file/edit_file/delete_file run, so the writer acts on the already-resolved location instead of re-traversing the symlink.

Fixes CL-6712
https://linear.app/abklabs/issue/CL-6712

resolveWorkspacePath already computes each candidate's realpath to decide
containment but returned the lexical path, leaving a TOCTOU window: a
symlink in-bounds at allow time could be retargeted before the actual
write, escaping the workspace. Return the resolved real path instead so
pathEscapePlugin substitutes it into the tool call args, and writers act
on the already-resolved location rather than re-traversing the symlink.

Fixes CL-6712
https://linear.app/abklabs/issue/CL-6712
@linear-code

linear-code Bot commented Aug 22, 2026

Copy link
Copy Markdown

CL-6712

@TheGreatAxios
TheGreatAxios merged commit 026a0f6 into main Aug 22, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant