Menu

Deleting files safely from a Tauri app: what I learned sending them to the Windows Recycle Bin from Rust
📰

Deleting files safely from a Tauri app: what I learned sending them to the Windows Recycle Bin from Rust

DEV Community: security·Dare·10 days ago
#nl7digFD
#devtosecurity#devto#dev#path#files
Reading 0:00
15s threshold

I'm building a disk cleaner for Windows in Rust and Tauri 2. Finding junk isn't the scary part. Deleting it is. If the scanner has a bug, you see a wrong number. If the delete path has a bug, someone loses files.

So the delete path ended up with more code and more tests than anything else in the app. Here's what it does and why. All the snippets are from the real source, trimmed a bit, with the file name on top.

One thing up front: not everything my app removes goes to the Recycle Bin. I'll get to that at the end, because I only fixed how the UI talks about it this week.

1. The webview only gets to delete what a scan returned

In Tauri the UI is a webview calling Rust commands. I treat it like any other client I don't control.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.