Repository navigation
Conversation
On macOS, /tmp is a symlink to /private/tmp. When the CLI resolves paths via fs.realpath and sends them to the gateway, the gateway's lexical path.relative() check rejects them because it compares /private/tmp/... against /tmp/... root, producing a traversal path. Add a realpath retry fallback in resolvePathWithinRoot() — when the initial lexical check fails, retry with fs.realpathSync on both root and resolved paths to handle symlink aliases transparently. Fixes openclaw#23107 Co-Authored-By: Claude Opus 4.6 <[email protected]>
PinoHouse
force-pushed
the
fix/browser-upload-symlink-path
branch
from
February 22, 2026 14:04
972f0b7 to
af479fc
Compare
Contributor
Author
|
Closing — upstream already resolved this in |
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
/tmp/openclaw/uploadson macOS ([Bug]: browser upload rejects valid files inside /tmp/openclaw/uploads #23107)/tmpis a symlink to/private/tmp. When the CLI resolves paths viafs.realpathand sends them to the gateway,resolvePathWithinRoot()compares/private/tmp/...against/tmp/...usingpath.relative(), which produces a traversal path (../../../private/tmp/...) and incorrectly rejects the filefs.realpathSyncretry fallback — when the initial lexical check fails, both root and resolved paths are canonicalized before re-checking containmentTest plan
pnpm test -- src/browser/paths.test.ts)pnpm tsgo)oxfmt --check)🤖 Generated with Claude Code
Greptile Summary
Fixed macOS
/tmpsymlink issue where upload validation incorrectly rejected valid files. On macOS,/tmp→/private/tmp, causingpath.relative()to produce traversal paths when comparing canonicalized file paths against lexical root paths. Addedfs.realpathSyncfallback that canonicalizes both paths before comparing, preserving all security checks (path traversal still rejected, symlinks still blocked byopenFileWithinRoot, non-existent paths handled gracefully).Confidence Score: 5/5
Last reviewed commit: 972f0b7
(4/5) You can add custom instructions or style guidelines for the agent here!