Skip to content

Deny dangling symlink components in nearest-realpath walks - #518

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-6715-deny-dangling-symlink-components-in-nearest-realpath-walks
Aug 22, 2026
Merged

Deny dangling symlink components in nearest-realpath walks#518
TheGreatAxios merged 2 commits into
mainfrom
cl-6715-deny-dangling-symlink-components-in-nearest-realpath-walks

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

realpathNearestOr's ambiguous realpath failure treated a dangling symlink's name as a normal missing-tail segment, so containment could see a symlink under cwd pointing outside as in-bounds before its target existed. lstat now distinguishes a genuinely missing component from one that exists but can't resolve (dangling link/loop), denying the latter in resolveWorkspacePath and underRoot.

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

realpathNearestOr treated a realpath failure as an always-missing tail
and rejoined the raw component name, so a dangling symlink under cwd
whose target didn't exist yet was reattached as a normal path segment
and read as in-bounds. Now lstat distinguishes "doesn't exist at all"
(safe, missing tail) from "exists but unresolvable" (dangling link or
symlink loop), and the latter denies via resolveWorkspacePath/underRoot.
@linear-code

linear-code Bot commented Aug 22, 2026

Copy link
Copy Markdown

CL-6715

@TheGreatAxios
TheGreatAxios merged commit eb5f0c2 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