2 Commits

Author SHA1 Message Date
EJClaw
c1d9242b81 voice-changer installer 1.0.4: refuse admin-token deploy; do not carry over the v1.0.2 uninstall log
Review/arbiter REVISE on 85f5782:
- If the installer is started elevated ("Run as administrator", admin terminal), ExecAsOriginalUser is
  elevated too, so deploy.ps1 copied into the user's folder and ran its scripts with admin rights.
  deploy.ps1 now checks the real token first (WindowsPrincipal.IsInRole(Administrator)) and exits 33
  before touching any path; the installer explains to start it by double-click. The post-install launch
  only runs when deploy succeeded (Check: DeployDone).
- v1.0.2 and later share AppId and uninstall dir, and the default UninstallLogMode=append kept v1.0.2's
  entries for files in the user's folder, which the elevated uninstaller would delete through a junction.
  UninstallLogMode=overwrite starts a fresh log. Since pre-existing folders are then not recorded as
  created, the uninstaller removes Program Files\VoiceChanger's apo\ scripts\ payload\ itself and launches
  a detached `rmdir` for the then-empty uninstall\ and install folder (Program Files only).

Windows 11 VM, Inno 6.7.4, AppVersion 1.0.4 (final build):
- A: setup started from an elevated process with /DATADIR=<Desktop>\VCA: deploy exit 33, the folder was
  never created, no shortcuts; REFUSED_BEFORE_WRITE PASS.
- L: deploy.ps1 under the logged-on user's limited token (Administrators deny-only) copies the app,
  folder owned by the user.
- C (control): v1.0.2 on Desktop -> v1.0.3, unins000.dat mentions Desktop\VC2; folder swapped for a junction
  to admin-only C:\vctarget, uninstall deletes the target's same-named files (FAIL, the bug).
- B: v1.0.2 on Desktop -> 1.0.4: unins000.dat no longer mentions it; same swap + uninstall: target files and
  SDDL unchanged (PASS); Program Files\VoiceChanger fully removed.
- R: fresh -> reinstall -> uninstall: Program Files\VoiceChanger fully removed; FxProperties restored.
- python unittest: 16 run, 2 skipped (tkinter missing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 23:04:18 +09:00
EJClaw
85f5782876 voice-changer installer: never touch the chosen folder with admin rights (1.0.3)
Review of c24cd1f: with a user-owned parent (Desktop), the user could swap the chosen folder for a junction
to a protected folder after secure-dir Prepare, and the elevated Finish would grant Users modify on the
target's config\ etc. Any elevated path operation on a user-controlled path has this race, so the elevated
installer now only works in Program Files.

- VoiceChanger.iss: {app} is always {commonpf}\VoiceChanger (apo\, scripts\mic-apo.ps1, scripts\deploy.ps1,
  uninstall\, payload\). The user's folder comes from a custom page (/DATADIR=, previous DataDir, or the
  v1.0.x App Path) and is only read for checks. deploy.ps1 runs with ExecAsOriginalUser: copies payload,
  moves data folders of an older install, runs install.ps1. Shortcuts are created after the copy
  (CreateShellLink; [Icons] made empty-target links) and the postinstall launch runs as the original user.
  Uninstall restores the mic settings and removes Program Files only; the user's folder is left (message).
- legacy.ps1 (replaces secure-dir.ps1): for a v1.0.0/1.0.1 folder (admin-locked, uninstall\ inside) deletes the
  old executable parts by name, moves the mic backup to Program Files and renames the folder to <dir>.old,
  only if no non-admin principal can delete/rename the folder or any ancestor (owner + ACL check; ACLs can
  only be changed by admins, so the check stays valid during the operation). Otherwise refuses (exit 20).
- deploy.ps1 (user level): refuses a junction; a v1.0.2 admin-locked folder under a user-owned parent is
  renamed aside by the user and its data folders moved into a fresh folder.
- mic-apo.ps1: back to its pre-c24cd1f logic (no -From); header documents the Program Files root.

Windows 11 VM, Inno 6.7.4, AppVersion 1.0.3:
- J: chosen folder = junction to admin-owned C:\vctarget (config\keep.txt, protected ACL): setup exit 0,
  legacy exit 0, deploy exit 31; target files + SDDL unchanged after setup, after limited-token deploy
  (exit 31), after limited-token write/icacls/rename attempts (all denied), and after uninstall.
- J2: same target with uninstall\unins000.exe: legacy exit 20, setup aborted (exit 7), target unchanged.
- U1: v1.0.1 at C:\VoiceChanger -> 1.0.3 with the default folder: legacy exit 1, backup moved byte-equal,
  models\mine.txt kept, C:\VoiceChanger.old removed, APO from Program Files; uninstall restores FxProperties.
- U2: v1.0.2 on Desktop -> limited-token deploy renamed it aside, moved models, new folder owned by the user;
  1.0.3 setup on it exit 0; uninstall restores FxProperties, folder and models kept.
- D: fresh Desktop install with full engine download: deploy exit 0, admin_root = Program Files,
  audiodg loads the Program Files DLL, APO 440 Hz + Communications PASS, Start menu/desktop shortcuts point
  at <Desktop>\VoiceChanger\VoiceChanger.exe and are removed on uninstall.
- python unittest: 16 run, 2 skipped (tkinter missing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 22:51:52 +09:00