mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-11 01:02:01 +03:00
security: fix arbitrary file read in read_text_file
Ensures the provided path is explicitly allowed by Tauri's scoped filesystem before reading it. Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
This commit is contained in:
parent
f41803c1b6
commit
b038586ede
1 changed files with 5 additions and 1 deletions
|
|
@ -598,7 +598,11 @@ fn migrate_data_dir(
|
|||
#[tauri::command]
|
||||
fn read_text_file(app: AppHandle, path: String) -> Result<String, String> {
|
||||
let p = std::path::PathBuf::from(&path);
|
||||
if !app.try_fs_scope().map(|scope| scope.is_allowed(&p)).unwrap_or(false) {
|
||||
if !app
|
||||
.try_fs_scope()
|
||||
.map(|scope| scope.is_allowed(&p))
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return Err("path not authorized".into());
|
||||
}
|
||||
let ext = p
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue