Repository navigation
Windows Theme Switcher v2.1.1
v2.1.1 — audit: bugs, security and cleanup
A full review of the Rust, TypeScript and config files found 12 bugs, 3 security issues and 4 optimisation opportunities. All are fixed. Details: docs/AUDIT.md.
Critical bug: the app could refuse to start
A config.json with valid JSON but invalid values (empty profile name, relative wallpaper path — e.g. after hand-editing) aborted startup, and the only way back was deleting the file manually. Invalid values are now backed up to config.json.invalid and replaced with defaults, exactly like a parse error. Verified on the release build.
Other fixes
- Autostart drift: only the existence of the Run value was compared, so after the executable moved the key kept pointing at the old path.
autostart::sync()now compares the path and rewrites it. - Stale tray checkmark for "Start with Windows".
save_settingspersisted the config before writing the Run key, leaving file and registry disagreeing on failure.hex_to_abgrsliced by byte index: a six-byte non-ASCII string panicked, which withpanic=abortkilled the app.APPLYINGguard,GetMessageWerror handling, focus-grace timestamp ordering, monitor-thread startup order, and two flaky parallel tests.
Security
- Crash triggerable by any local process:
wide_ptr_to_stringdereferenced thelParamofWM_SETTINGCHANGEwithout validation. The region is now validated withVirtualQuerybefore reading. - CSP tightened: the production policy still allowed
ws://localhost:*,http://localhost:*,asset:,blob:and'unsafe-inline'(v1 leftovers). It is now minimal (default-src 'self',object-src 'none',frame-ancestors 'none'…) with a separatedevCsp; the inline boot<style>moved topublic/boot.css. The panel renders identically under the new policy. - Log rotation at 256 KB.
Optimisation
Unused windows-crate features, the dead isWindows11 field, dead code/tests and stale comments removed; now_ms() is monotonic.
Verification: 36 unit tests pass (5 new), no compiler warnings, tsc clean, idle working set still 148 KB, theme apply still 1 ms.