Canonicalize wallpaper preview path before the asset scope #88
No reviewers
Labels
No labels
breadbug
bug
displays
enhancement
keybinds
network
phase-1
power
privacy
recovery
search
snapshots
sound
ui
ux
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Breadway/bos-settings!88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/bset-85-wallpaper-canonicalize"
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
BSET-85 (medium confidence, found in review of PR #80 / BSET-70). Confirmed from source:
breadpaper.rsallow_previewpassed the raw current-wallpaper path toasset_protocol_scope().allow_file()and checked the extension and existence on that raw path. A symlink named*.pngcould point the scope at a non-image target, because the checks never saw the file the scope actually grants.allow_previewhad no unit test.What changed
preview_target(path) -> Option<PathBuf>: pure function. Rejects relative paths, runsstd::fs::canonicalize, then requires the resolved path to have an image extension and to be a regular file. Returns the resolved path.allow_previewnow callspreview_targetand grants the scope only the resolved file. Behaviour is otherwise unchanged.commands::breadpaper::tests, using pid-scoped tempdirs cleaned up on drop: normal image allowed; missing file refused; symlink named.pngto a non-image refused; symlink named.pngto a real image resolves to the target; relative path refused; directory named like an image refused.Tests and gates (run locally)
cd src && cargo test --lib: 200 passed, 0 failed (includes the 6 new breadpaper tests, all passing).cargo test --lib breadpaper: 6 passed, 0 failed.cargo clippy --lib --tests -- -D warnings: exit 0, no warnings.rustfmt --check src/commands/breadpaper.rs: exit 0 (this file is clean).cargo fmt --checkfor the whole crate. It fails onsrc/commands/power_settings.rs, which already fails on origin/main and is not touched here. Recorded as a finding, not fixed in this PR.frontend/buildwas missing. Created a real empty directory at/tmp/opencode/bset85-frontend-buildand symlinkedfrontend/buildto it, per the card instruction. The path is gitignored (frontend/.gitignore:/build) and is not in the commit.allow_filecall is a one-line wrapper and was not run against a live webview.Refs BSET-85
Review of PR #88 (BSET-85), exact head
7a712a9a2f(re-read from Forgejo before review: matches). Base on the PR isfe03b457but merge-base is2ba912b2.VERDICT: BLOCKED (code is acceptable, no code changes requested; the required CI check is red on this head)
Required check on this exact SHA: "check / check (push)" = failure ("Failing after 14s", run 187). It is the only status on the SHA. Not waived.
Cause of the red check (verified independently): on the head,
cargo fmt --all -- --checkreports exactly 3 diffs, all in src/src/commands/power_settings.rs (lines 415, 422, 431). The PR touches only src/src/commands/breadpaper.rs, so those come from the stale base2ba912b2, fixed on main by #89 (fe03b457). I did not read the CI job log itself; the fmt reproduction is the evidence.Merge of head into current main (
fe03b457), trial merge in a scratch clone, clean, no conflicts, diff vs main still only breadpaper.rs (+108/-3):Note: CI runs
cargo clippy --all-targetsandcargo test(not --lib); I ran the commands you specified, not the full CI set.Code review (src/src/commands/breadpaper.rs):
Tests: 6 tests exercise normal, missing, symlink to non-image, symlink to image, relative, directory-named-image. Assertions check the returned value (including that the symlink case returns the target path), not just is_some. Scratch dirs are pid-scoped under temp_dir, removed up front and on Drop (RAII, runs on assertion panic too); I confirmed no bos-settings-breadpaper-test-* directories remain in /tmp after the run. Unix-only symlink usage is fine for this Linux-only app. The PR body's claim that the tests pass and that the Tauri scope itself was not run against a live webview is accurate; I also did not run a live webview.
Nits, non-blocking: no test for an uppercase extension (e.g. WALL.PNG) or a dangling symlink; adding them would pin the case-insensitive and canonicalize-failure paths.
Scope and conventions: diff is one file, 108 additions, 3 deletions, matching the PR body. No CHANGELOG file exists in the repo and neither CONTRIBUTING.md nor AGENTS.md mandates one, so none is required. No em or en dashes in the diff. Branch name follows fix/x.
Required action: bring the branch up to date with main (merge or rebase onto
fe03b457) so the new head passes the fmt gate, wait for check to go green on that new SHA, then request a fresh review of the new head (the SHA will change; the code diff should be identical). No code changes needed from this review.Review of PR #88 (BSET-85), exact head
bd0e090a81(re-read from Forgejo before review and again before posting: matches). Base mainfe03b457, merge-basefe03b457.VERDICT: PASS (head
bd0e090a81)Independent verification, not relying on the earlier review (comment 5668, old head
7a712a9a):6bab71ea37, identical to the tree of a trial merge of old head7a712a9ainto mainfe03b457. The only difference from7a712a9ais the power_settings.rs rustfmt change that came in from main (#89). No force-push, no extra changes.bd0e090ais success (Successful in 5m45s, run 192). It is the only status and the only required check I could observe. No outstanding reviews or change requests on the PR (reviews API empty; the only comment is 5668).Not merged, card not moved. Awaiting merge decision by the coordinator.