Repository navigation
Conversation
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: ASSERTIVE
- Plan: Team
- Run ID:
167e6361-55b1-4d4b-a650-4416eabda3f8
📒 Files selected for processing: 14
tauri-app/src-tauri/Cargo.tomltauri-app/src-tauri/src/commands.rstauri-app/src-tauri/src/launch_hotkey.rstauri-app/src-tauri/src/lib.rstauri-app/src-tauri/src/shortcuts.rstauri-app/src-tauri/src/types.rstauri-app/src-tauri/tauri.conf.jsontauri-app/src-tauri/windows/installer-hooks.nshtauri-app/src/components/settings/settings/SettingsTab.tsxtauri-app/src/hooks/useHotkey.tstauri-app/src/lib/tauri.tstauri-app/src/lib/types.tstauri-app/src/stores/settings-store.reset.test.tstauri-app/src/stores/settings-store.ts
Included review availability: This review used your included allowance. 7 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: ASSERTIVE
- Plan: Team
- Run ID:
8f8f7aba-b354-4450-8ffe-da6f01789e57
📒 Files selected for processing: 3
tauri-app/src-tauri/src/launch_hotkey.rstauri-app/src-tauri/windows/installer-hooks.nshtauri-app/src/components/settings/settings/SettingsTab.tsx
Included review availability: This review used your included allowance. 6 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.
| use std::sync::Mutex; | ||
|
|
||
| pub const TOGGLE_ARG: &str = "--toggle-overlay"; | ||
| pub const LAUNCH_TASK: &str = "Cleanmeter Overlay Hotkey"; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
The task name is machine-global and different users overwrite each other's task.
LAUNCH_TASK is a fixed name in the root task folder. Suppose user A enables the option and user B enables it later. /Create ... /F then replaces A's task with B's SID principal. A's Start Menu link still runs that task, so A's hotkey runs under B's identity or fails. In the same way, when B disables the option, /Delete /TN ... /F deletes the task that A's link uses.
Fix: put the user SID in the task name, for example Cleanmeter Overlay Hotkey {SID}. Use the same name in register_task, the delete call on Line 231, and write_link arguments. Update the uninstall hook to match.
| r#"<?xml version="1.0" encoding="UTF-16"?> | ||
| <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> | ||
| <Triggers /> | ||
| <Principals><Principal id="User"><UserId>{}</UserId><LogonType>InteractiveToken</LogonType><RunLevel>HighestAvailable</RunLevel></Principal></Principals> |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
fd -a tauri.conf.json | xargs -I{} sh -c 'echo "== {}"; jq ".bundle.windows // .tauri.bundle.windows" {}'
rg -n -C3 'installMode|perMachine|currentUser' -g '*.json' -g '*.nsh' -g '*.nsi'Repository: SupaStellar/Cleanmeter
Length of output: 1084
🏁 Script executed:
#!/bin/bash
set -o pipefail
printf '%s\n' '== launch_hotkey.rs =='
nl -ba tauri-app/src-tauri/src/launch_hotkey.rs | sed -n '1,280p'
printf '%s\n' '== lib.rs elevation and argument routing =='
rg -n -C8 -F -e 'runas' -e 'is_overlay_launch' -e 'toggle-overlay' -e 'std::env::args' -e 'Command::new' tauri-app/src-tauri/src/lib.rs tauri-app/src-tauri/src
printf '%s\n' '== installer hook =='
nl -ba tauri-app/src-tauri/windows/installer-hooks.nsh | sed -n '1,240p'
printf '%s\n' '== tauri config and package metadata =='
nl -ba tauri-app/src-tauri/tauri.conf.json | sed -n '55,82p'
rg -n -C4 -F -e 'productName' -e 'identifier' -e 'currentUser' -e 'ProgramFiles' -e 'LOCALAPPDATA' tauri-app/src-tauri/tauri.conf.json tauri-app/src-tauri/Cargo.toml tauri-app/package.jsonRepository: SupaStellar/Cleanmeter
Length of output: 42490
🏁 Script executed:
#!/bin/bash
set -o pipefail
printf '%s\n' '== Tauri versions and installer references =='
rg -n -C3 -F -e 'tauri = ' -e 'tauri-build' -e 'tauri-cli' -e 'installMode' -e 'currentUser' -e 'APPDATA' -e 'LOCALAPPDATA' -e 'ProgramFiles' --glob 'Cargo.toml' --glob 'Cargo.lock' --glob '*.json' --glob '*.nsh' --glob '*.nsi' --glob '*.rs' .
printf '%s\n' '== installer-related files =='
rg --files tauri-app/src-tauri | rg '(^|/)(windows|installer|nsis|tauri).*(nsh|nsi|toml|json)$|tauri.conf'Repository: SupaStellar/Cleanmeter
Length of output: 3066
🌐 Web query:
official Tauri 2 NSIS installMode currentUser installation path permissions
💡 Result:
In **Tauri 2**, NSIS `installMode: "currentUser"` means a per-user install:
```json
{
"bundle": {
"windows": {
"nsis": {
"installMode": "currentUser"
}
}
}
}
```
- **Privileges:** The installer does not require Administrator privileges.
- **Default location:** `%LOCALAPPDATA%\<ProductName>`—not `Program Files`. The app is installed for the current Windows user, not system-wide.
- **Registry metadata:** Stored under `HKCU`.
- **Path permissions:** The per-user install location is intended to be writable without admin rights. This is separate from Tauri’s app permissions/capabilities: `installMode` does **not** grant the frontend access to files or other system APIs. Configure those through Tauri capabilities and plugin permissions.
- **Custom paths:** The official docs say relative paths can work for per-user NSIS installs; they do not establish that `installMode` itself provides a setting to change the installer’s default directory. ([v2.tauri.app](https://v2.tauri.app/reference/config/?utm_source=openai))
For comparison, `perMachine` installs to `Program Files` and requires administrator privileges; `both` offers a choice but still requires administrator privileges. ([v2.tauri.app](https://v2.tauri.app/reference/config/?utm_source=openai))
Citations:
- 1: https://v2.tauri.app/reference/config/?utm_source=openai
- 2: https://v2.tauri.app/reference/config/?utm_source=openai
Do not create a HighestAvailable task for the per-user installation.
installMode: "currentUser" installs the application under %LOCALAPPDATA%, which is writable by the user. The task runs current_exe() with RunLevel=HighestAvailable. Therefore, a medium-integrity process running as the registered administrator can replace the executable and invoke schtasks.exe /Run to launch attacker-controlled code without the normal runas consent prompt.
Retain the runas flow for per-user installations. Alternatively, register this task only when the executable and its parent directory are protected from modification by the user.
| IfFileExists "$SMPROGRAMS\Cleanmeter Overlay.lnk" 0 cleanmeter_hotkey_removed | ||
| ExecShellWait "runas" "$SYSDIR\schtasks.exe" '/Delete /TN "Cleanmeter Overlay Hotkey" /F' SW_HIDE | ||
| Delete "$SMPROGRAMS\Cleanmeter Overlay.lnk" | ||
| cleanmeter_hotkey_removed: |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
rg -n -C3 'SetShellVarContext|installMode|NSIS_HOOK' -g '*.nsh' -g '*.nsi' -g '*.json'Repository: SupaStellar/Cleanmeter
Length of output: 1120
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- PR diff ---'
git diff --no-ext-diff --unified=30 0eb9f7c9369202297b697c08ee957f2fab520b74 42da9df02bd496483965195d110887f678171b36 -- tauri-app/src-tauri/windows/installer-hooks.nsh tauri-app/src-tauri tauri-app/src
printf '%s\n' '--- relevant identifiers ---'
rg -n -C4 -F -e 'Cleanmeter Overlay Hotkey' -e 'Cleanmeter Overlay.lnk' -e 'FOLDERID_Programs' -e 'CreateShortcut' -e 'DeleteShortcut' -e 'SetShellVarContext' tauri-app/src-tauri tauri-app/src || test "$?" -eq 1Repository: SupaStellar/Cleanmeter
Length of output: 42923
Do not gate task cleanup on the shortcut file.
If the user deletes Cleanmeter Overlay.lnk before uninstall, IfFileExists skips the scheduled-task deletion. Delete the task independently of the link.
Suggested fix
- IfFileExists "$SMPROGRAMS\Cleanmeter Overlay.lnk" 0 cleanmeter_hotkey_removed
ExecShellWait "runas" "$SYSDIR\schtasks.exe" '/Delete /TN "Cleanmeter Overlay Hotkey" /F' SW_HIDE
Delete "$SMPROGRAMS\Cleanmeter Overlay.lnk"
- cleanmeter_hotkey_removed:📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| IfFileExists "$SMPROGRAMS\Cleanmeter Overlay.lnk" 0 cleanmeter_hotkey_removed | |
| ExecShellWait "runas" "$SYSDIR\schtasks.exe" '/Delete /TN "Cleanmeter Overlay Hotkey" /F' SW_HIDE | |
| Delete "$SMPROGRAMS\Cleanmeter Overlay.lnk" | |
| cleanmeter_hotkey_removed: | |
| ExecShellWait "runas" "$SYSDIR\schtasks.exe" '/Delete /TN "Cleanmeter Overlay Hotkey" /F' SW_HIDE | |
| Delete "$SMPROGRAMS\Cleanmeter Overlay.lnk" |
The overlay shortcut currently works only while Cleanmeter is running. Add an optional Settings > Shortcuts > Launch when closed checkbox so the same Show/hide overlay shortcut can also open Cleanmeter after Quit. Existing installations keep this disabled.
Windows Explorer owns a per-user Start Menu shortcut that invokes a dedicated on-demand scheduled task. The already-elevated app installs the task; it has no logon trigger and does not enable startup with Windows. Subsequent presses launch or toggle without another UAC prompt. No additional resident helper is needed. Launch mode supports Ctrl+Alt, optionally Shift, with letters, numbers, Space, or F1–F11; unsupported choices show validation feedback.
Cold launches keep Settings hidden. Subsequent launches toggle the existing overlay, including requests received while the UI and sensors are initializing. Disabling or clearing the shortcut removes the link and task and restores normal in-app hotkey registration. Shortcut controls are disabled while configuration is being saved. Reset and uninstall also include cleanup; uninstall can request administrator approval to remove the elevated task.
Validation: