mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-16 03:09:33 +01:00
fix: keep a root=live listing inside the session folder (release review)
The lookup judges liveWorktree.path lexically and only when the pane moves, while the route's probe and readdir both follow symlinks. A symlink put at that path, or at a parent of it, without moving the pane re-rooted the listing outside workingDir. Names and sizes leaked, while file-content and file-raw still refused the paths. The route now resolves both folders on every request and walks the worktree only when it lies strictly inside the resolved workingDir, otherwise it walks workingDir. Only the check uses the resolved paths: the walk keeps the session's spelling, so a workspace reached through a symlink still gets paths relative to workingDir. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
89a93c871f
commit
5c1ec46b6f
5 files changed
+109
-12
No files matched your search
+11
-6
@@ -13,12 +13,17 @@
|
||||
* than by running `git worktree list`: this runs from the pane watcher whenever a directory
|
||||
* changes, and a file read starts no process, no repository config and no filter.
|
||||
*
|
||||
* Only a folder at or below `workingDir` is ever an answer, and that is the whole security
|
||||
* argument: the file routes already serve everything under `workingDir`, so following a pane
|
||||
* there widens nothing, and a planted `.git` file can only move where the listing STARTS inside
|
||||
* that same folder. A worktree outside it (`git worktree add ../feature`) stays unfollowed, since
|
||||
* listing it would need a second confinement root. Nothing here is a confinement decision: the
|
||||
* routes keep judging every path against `workingDir`.
|
||||
* Only a folder strictly below `workingDir` is ever an answer: the file routes already serve
|
||||
* everything under it, so following a pane there widens nothing, and a planted `.git` file can
|
||||
* only move where the listing STARTS inside that same folder. A worktree outside it
|
||||
* (`git worktree add ../feature`) stays unfollowed, since listing it would need a second
|
||||
* confinement root.
|
||||
*
|
||||
* That answer is lexical and only as fresh as the last time the pane moved: a symlink can take the
|
||||
* folder's place afterwards without moving the pane. So nothing here is a confinement decision.
|
||||
* `GET /api/sessions/:id/files` resolves the folder on every request and walks it only while it
|
||||
* really lies inside `workingDir` (`canWalkLiveWorktree()` in file-routes.ts), and the routes keep
|
||||
* judging every path against `workingDir`.
|
||||
*
|
||||
* Probes are bounded (#516). The folder can sit on a mount that stopped answering, and an
|
||||
* `unknown` answer stops the walk rather than being read as "no `.git` here".
|
||||
|
||||
Reference in new issue
Block a user