fix(core): resolve symlink on fs scope check (#9072)

This commit is contained in:
Lucas Fernandes Nogueira 2024-03-04 21:10:55 -03:00 committed by GitHub
parent 6a47dd212c
commit fe18012d30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": patch:bug
---
Resolve symlinks on the filesystem scope check.

View File

@ -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 {