fix(ssh): treat symlinked directories as folders#1717
Merged
Conversation
Co-authored-by: Orca <help@stably.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1661 and #1672.
PR #1672 removed the SSH relay path allowlist so symlink targets outside the workspace can be opened, but directory symlinks were still misclassified by directory listings:
fs.readDirusedDirent.isDirectory(), which returnsfalsefor symlink entries.readFile, which failed withEISDIR: illegal operation on a directory, read.This PR makes directory listings report symlink-to-directory entries as directories while preserving
isSymlink: true.What changed
fs.readDirfollows symlink entries withstat()only to determine whether the target is a directory.fs.statreturns the target file/directory type for symlinks, falling back tosymlinkfor broken links.fs:readDirgets the same symlink-to-directory behavior, but still resolves through the existing authorized-path boundary.Verification
pnpm test src/relay/fs-handler.test.ts src/main/ipc/filesystem.test.tspnpm tc:nodeopenclaw 2using/home/jinwoo/Documents/repo-test/Model -> /tmp/orca-repo-test-symlink-targetNote: local commands emitted the existing Node engine warning because this machine is on Node v25.9.0 while the repo wants Node 24, but both commands passed.
Made with Orca 🐋