Skip to content

Windows Theme Switcher v2.1.1

Choose a tag to compare

@DashAkoul DashAkoul released this 26 Oct 12:11
· 6 commits to main since this release

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_settings persisted the config before writing the Run key, leaving file and registry disagreeing on failure.
  • hex_to_abgr sliced by byte index: a six-byte non-ASCII string panicked, which with panic=abort killed the app.
  • APPLYING guard, GetMessageW error handling, focus-grace timestamp ordering, monitor-thread startup order, and two flaky parallel tests.

Security

  • Crash triggerable by any local process: wide_ptr_to_string dereferenced the lParam of WM_SETTINGCHANGE without validation. The region is now validated with VirtualQuery before 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 separate devCsp; the inline boot <style> moved to public/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.