fix: RunOnce startup items report an honest 'cannot disable' instead of a fake success#1428
Merged
Merged
Conversation
…of a fake success The scan lists both Run and RunOnce registry keys, and SetEnabledAsync keyed purely off the entry's scope, so disabling a RunOnce entry wrote the disabled blob to StartupApproved\Run and returned true. Windows has no StartupApproved\RunOnce and never consults StartupApproved for RunOnce keys, so the item still ran at next boot while the UI showed 'Disabled' — a system-mutation toggle that silently lied. SetEnabledAsync now detects a RunOnce entry (RegistryKey ends with 'RunOnce') and returns a truthful non-success with a plain-language message instead of writing an ineffective blob. The item stays visible (the user still sees it's scheduled once). The ViewModel already reverts the checkbox on a false return, so the toggle snaps back and the status explains why. Fixes ultra-audit finding P2 #35. Regression test: SetEnabledAsync_RunOnce_ReturnsFalseWithHonestMessage_AndDoesNotDisable (HKCU + HKLM RunOnce) — returns false, status contains 'run-once', IsEnabled stays true. Red before (returned true, IsEnabled=false, AND wrote the real HKCU registry); green after (short-circuits before any write).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fresh ultra-audit finding (services-O-S, P2), verified against current source.
The Startup scan lists both the
RunandRunOnceregistry keys, andSetEnabledAsynckeyed purely off the entry's scope (RegistryCurrentUser/RegistryLocalMachine). So disabling aRunOnceentry wrote the "disabled" blob to…\Explorer\StartupApproved\Run\{name}and returned true. But Windows has noStartupApproved\RunOncesubkey and never consultsStartupApprovedforRunOncekeys — so the command still ran at the next boot while the UI reported "Disabled". For a startup manager aimed at non-technical users, a disable that claims success but doesn't disable is a trust/correctness defect.Fix
SetEnabledAsyncnow detects aRunOnceentry (itsRegistryKeyends withRunOnce) and returns a truthful non-success with a plain-language message — "Run-once item — runs next boot, then removes itself; cannot be disabled here." — instead of writing an ineffective blob. The item stays visible (the user still sees it's scheduled to run once), and the ViewModel already reverts the checkbox on afalsereturn, so the toggle snaps back with the explanation.Regression test
SetEnabledAsync_RunOnce_ReturnsFalseWithHonestMessage_AndDoesNotDisable(HKCU + HKLM RunOnce): returnsfalse, status contains "run-once",IsEnabledstaystrue. Red before the fix (returnedtrue, flippedIsEnabledto false, and wrote the real HKCU registry as a side effect); green after (the guard short-circuits before any registry access).Checks
Runentries are unaffected — only keys ending inRunOncehit the guard.