Skip to content

fix(privacy): make privacy shield toggles bidirectional#63

Merged
dbfx merged 5 commits intomainfrom
fix/privacy-shield-bidirectional-toggle
Mar 24, 2026
Merged

fix(privacy): make privacy shield toggles bidirectional#63
dbfx merged 5 commits intomainfrom
fix/privacy-shield-bidirectional-toggle

Conversation

@dbfx
Copy link
Contributor

@dbfx dbfx commented Mar 24, 2026

Summary

  • Privacy Shield toggles were one-directional — once a protection was enabled, it could never be disabled. This made it impossible for users to revert settings they were only testing.
  • Added revert() methods to all 57 Windows privacy settings with correct undo logic per setting type (registry policy keys are deleted to restore Windows default; HKCU user keys are set back to their default value; scheduled tasks are re-enabled; services are set to Manual start).
  • Added PRIVACY_REVERT IPC channel end-to-end (channels, main handler, preload bridge, renderer) so the existing toggle UI now calls privacyApply or privacyRevert depending on current state.
  • Non-reversible settings (macOS/Linux, where revert is not yet implemented) remain locked when enabled via a new reversible flag on PrivacySetting.

Test plan

  • On Windows, scan privacy settings, enable a toggle → verify it turns green
  • Click the same toggle again → verify it reverts (turns gray) and a "reverted to default" toast appears
  • Toggle a scheduled task setting (e.g. Maps Toast Task) on and off
  • Toggle a service setting (e.g. DiagTrack) on and off
  • Toggle a registry policy setting (e.g. Windows Telemetry) on and off
  • Toggle a HKCU setting (e.g. Advertising ID) on and off
  • Verify "Protect All" bulk button still works (apply-only, no change)
  • Verify dependent settings (with dependsOn) still show the dependency warning and stay disabled when the parent is off
  • On macOS/Linux, verify toggles remain locked once enabled (no revert support yet)

Fixes #63

🤖 Generated with Claude Code

Privacy Shield toggles were one-directional — once enabled, protection
could never be disabled. This made it impossible for users to revert
settings they were only testing.

Add revert() to all 57 Windows privacy settings with correct undo logic:
- Policy registry keys: delete value (restores Windows default)
- HKCU user keys: set back to default enabled value
- Scheduled tasks: re-enable via schtasks
- Services: set start type to Manual (3)

Add PRIVACY_REVERT IPC channel, preload bridge, and update the UI toggle
to call apply or revert based on current state. Non-reversible settings
(macOS/Linux, where revert is not yet implemented) stay locked when
enabled via a new `reversible` flag on PrivacySetting.

Fixes #63

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7556e6ea08

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…e missing reg values

- disableService now captures the original Start type (e.g. Automatic=2)
  before overwriting to Disabled=4, stored in an in-memory Map
- enableService restores the captured value, falling back to Manual=3
  if the app was restarted and the original is unknown
- regDeleteValue now silently succeeds if the value was already deleted
  or never existed, avoiding confusing error toasts on double-revert

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1cff8154f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

dbfx and others added 2 commits March 24, 2026 09:21
Settings that report enabled=true because the underlying resource
doesn't exist (browser not installed, task missing, service absent)
should not offer a revert toggle. Added `applicable` checks for all
task, service, and browser settings so the UI correctly disables
the toggle when the resource is absent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ypes

P1: regDeleteValue now only swallows "unable to find" errors (key/value
doesn't exist). Access denied and other failures are re-thrown so
revertPrivacySettings reports them accurately instead of silently
claiming success.

P2: Original service start types are now persisted to a JSON file in
userData instead of an in-memory Map. This means an apply → app restart
→ revert flow correctly restores the original start mode (Automatic,
Manual, etc.) instead of always falling back to Manual (3).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dbfx
Copy link
Contributor Author

dbfx commented Mar 24, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35b0bfcab7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…vert

Move the cache delete + persist to after the registry write so a failed
revert (access denied, timeout, etc.) retains the original value for
retry instead of silently falling back to Manual (3).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dbfx dbfx merged commit e72cfc2 into main Mar 24, 2026
8 checks passed
@dbfx dbfx deleted the fix/privacy-shield-bidirectional-toggle branch March 24, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant