Skip to content

Commit

Permalink
fix(core): resolve symlink on fs scope check (#9072)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Mar 5, 2024
1 parent 6a47dd2 commit fe18012
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-fs-scope-check-symlink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch:bug
---

Resolve symlinks on the filesystem scope check.
8 changes: 8 additions & 0 deletions core/tauri/src/scope/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ impl Scope {
/// Determines if the given path is allowed on this scope.
pub fn is_allowed<P: AsRef<Path>>(&self, path: P) -> bool {
let path = path.as_ref();
let path = if path.is_symlink() {
match std::fs::read_link(path) {
Ok(p) => p,
Err(_) => return false,
}
} else {
path.to_path_buf()
};
let path = if !path.exists() {
crate::Result::Ok(path.to_path_buf())
} else {
Expand Down

0 comments on commit fe18012

Please sign in to comment.