Skip to content

fix: request only required registry write access - #100

Merged
itsfatduck merged 1 commit into
itsfatduck:masterfrom
evachxji:fix/issue-99-news-interests-registry
Nov 10, 2026
Merged

itsfatduck merged 1 commit into
itsfatduck:masterfrom
evachxji:fix/issue-99-news-interests-registry

Conversation

@evachxji

Copy link
Copy Markdown
Contributor

Description

RegistryService.Write opened existing keys with full KEY_WRITE, which also requests CreateSubKey access even when the operation only sets a value. On a key whose ACL allows SetValue but denies CreateSubKey, this produced Access denied.

Writes now request only ReadKey | SetValue. Other registry operations are unchanged.

Closes #99

Type of change

  • feat: — New optimization, customize setting, or app feature
  • fix: — Bug fix
  • refactor: — Code restructuring without behavior change
  • docs: — Documentation
  • test: — Adding or fixing tests
  • i18n: — Translation / localization update
  • chore: — Build, deps, CI, tooling

Screenshots (if UI changes)

Not applicable; no UI changes.

Notes

Added a regression using an ACL-protected key under HKCU\Software\TestOptimizerDuck that permits SetValue but denies CreateSubKey. It failed with Access denied before the change and passes after it. The test restores the ACL and cleans up its test keys; real Dsh and Feeds values were not modified.

Validation:

  • Focused regression: 1 passed (rerun independently after commit)
  • Related RegistryServiceTests: 27 total, 0 failed, 1 skipped
  • Full suite: 756 total, 0 failed, 6 conditionally skipped
  • Release build: 0 warnings, 0 errors
  • csharpier check .: 302 files passed
  • git diff --check: passed

The reporter's Windows build 26300, elevated-only scenarios, UI execution, and upstream CI were not run locally; local validation used Windows build 26200.

@evachxji
evachxji requested a review from itsfatduck as a code owner November 10, 2026 04:48

@itsfatduck itsfatduck left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for this great fix! I honestly hadn't thought about how accessing more than the required permissions could lead to an Access Denied error.

I'll definitely learn from this and apply the same approach to other APIs to help prevent similar Access Denied issues in the future.

Really appreciate your contribution!

@itsfatduck
itsfatduck merged commit 6b0f6d5 into itsfatduck:master Nov 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When attempting to enable "禁用资讯和兴趣" (DisableNewsAndInterests), the optimization fails with a registry write error: "Access denied".

2 participants