Restrict File Access to USB Devices Only on Linux #10502
-
Hi, I'm working on an application where I need to restrict users to open files only from USB storage devices on a Linux system. I understand that setting the scope for the fs module in tauri.conf.json can limit file access paths, but this doesn't prevent the open file dialog from showing other locations on the system. Is there a way to configure the Tauri application so that the open file dialog only displays USB storage devices and prevents access to any other directories? Ideally, the user should only be able to see and select files from USB devices mounted under typical mount points like /media or /mnt. Any guidance or suggestions on how to achieve this would be greatly appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I don't think the os/gtk file picker APIs we use have any way of doing this but if you ship your app as a flatpak you may be able to leverage its sandbox for that 🤔 |
Beta Was this translation helpful? Give feedback.
Yes.
Hmm, i don't think i have anything with context, but essentially once you have access to an AppHandle (for example in commands) you essentially do
app_handle.fs_scope().allow_file(path)
or any of these apis: https://docs.rs/tauri/latest/tauri/scope/struct.FsScope.html (should be the same for v2)