Wallpaper preview: canonicalize the path before allowing it in the asset scope #86
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
How it was found: independent review of PR #80 (BSET-70), comment 4819, which included a mock-runtime check against tauri 2.11.5.
Confidence: medium. Reasoned from tauri's scope behaviour and checked with a throwaway mock test, not reproduced in the app.
Explanation: breadpaper.rs
allow_previewpasses the current wallpaper path straight toasset_protocol_scope().allow_file(). Tauri resolves one symlink level when it checks access, so if the current wallpaper is a symlink named*.png, the webview can read the link's target. Exploiting this needs the user's own breadpaper state to point at such a link, so the risk is low. Separately, the scope only grows during an app session (nothing is revoked when the wallpaper changes), andallow_previewhas no unit test.Fix:
std::fs::canonicalizethe path and re-check the extension on the resolved path beforeallow_file. Add a mock-runtime test: an absolute existing image is allowed, its siblings are not, a symlink to a non-image is refused.PR opened: #88 (Breadway/bos-settings #88)
Head SHA:
7a712a9a2fpreview_target() canonicalizes before every check, and scope grants the resolved file. cargo test --lib: 200/200 passed (6 new breadpaper tests). Clippy -D warnings clean. Not run against a live webview. Needs independent review.