Skip to content

Commit fe18012

Browse files
authored
fix(core): resolve symlink on fs scope check (#9072)
1 parent 6a47dd2 commit fe18012

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch:bug
3+
---
4+
5+
Resolve symlinks on the filesystem scope check.

core/tauri/src/scope/fs.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ impl Scope {
298298
/// Determines if the given path is allowed on this scope.
299299
pub fn is_allowed<P: AsRef<Path>>(&self, path: P) -> bool {
300300
let path = path.as_ref();
301+
let path = if path.is_symlink() {
302+
match std::fs::read_link(path) {
303+
Ok(p) => p,
304+
Err(_) => return false,
305+
}
306+
} else {
307+
path.to_path_buf()
308+
};
301309
let path = if !path.exists() {
302310
crate::Result::Ok(path.to_path_buf())
303311
} else {

0 commit comments

Comments
 (0)