mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-10-10 22:38:44 +02:00
In plugins/fs/src/commands.rs resolve_path / is_forbidden, only paths that already existed were canonicalized, so a new file below a symlinked directory in the scope was matched by its unresolved path and written outside of the scope. Relative symlink targets were resolved against the process CWD, only the link target was checked against deny patterns, and resolution errors made is_forbidden fail open. resolve_path now computes the real path (canonical nearest existing ancestor + remaining components, following dangling symlinks relative to their parent, bounded to 40 links) and checks it against the allow and deny patterns; deny patterns also match the path as given. Resolution errors fail closed. Unit tests cover symlinked ancestors, relative and dangling links and loops.
565 B
565 B
fs, fs-js
| fs | fs-js |
|---|---|
| patch | patch |
Security: the fs scope check now resolves symlinks in the ancestors of paths that do not exist yet, and resolves relative symlink targets against the link's directory instead of the process working directory. Previously a new file created below a symlinked directory inside the scope (writeFile, mkdir, create, rename, copyFile, ...) was written outside of the scope. Deny patterns now also apply to the path as given, so they can name a symlink, and a path whose symlinks cannot be resolved (e.g. a loop) is rejected.