You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security: prevent arbitrary file read via path traversal in file share #498
The /api/files/browse and /api/files/download endpoints in src/server/signalling/handlers/fileShare.ts resolve user-provided path parameters without verifying if the resolved path remains within an allowed boundary. This allows a client to read arbitrary files from the host system (e.g., /etc/passwd or C:\Windows\win.ini).
Scope
Security fix. Restrict filesystem access to the user's Home directory (os.homedir()) and the designated Upload directory (getUploadDir()).
Add an isPathSafe(targetPath) helper in fileShare.ts.
Apply the guard in handleFileBrowse: fallback to the default upload directory if the path is unsafe.
Apply the guard in handleFileDownload: return a 403 Forbidden if the path is unsafe.
Implement Windows-specific case normalization (toLowerCase()) inside the helper to prevent bypasses like C:\Users vs c:\users.
Not in scope
handleFileUpload (uploads are already strictly sanitized via path.basename()).
Completely disabling filesystem browsing (the feature is meant to allow host browsing, but it must be sandboxed to the user's home/upload directories).
Verification
npm run test passes locally (7 test files, 43 tests passed).
Manually tested attempting to browse/download paths outside the home directory; correctly falls back or returns 403.
Activity
github-actions commentedon Nov 17, 2026
Discussions are carried on Discord.
Instead of commenting here, go to the Discord channel.
macOS and macOS-related issues are not supported at the moment. We are looking for funding to support macOS and would appreciate sponsorships.
If you find this project useful, a GitHub star would be appreciated.