Repository navigation
fix(main): validate sender on direct update IPC handlers and restrict window navigation - #1200
Merged
Merged
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Intent
validate sender on direct update IPC handlers and restrict window navigation (#1184)
What Changed
isTrustedMainWindowSenderinmain/update-ipc.tsandmain/ipc.ts, rejecting requests from non-main windows, unexpected frames, or unverified origins.createMainWindowWillNavigateHandleronwill-navigate, confining in-window navigation to allowed local URLs, delegating safe external URLs to the default system browser viashell.openExternal, and blocking unsafe schemes.tests/update-ipc-sender-validation.test.tsand updated desktop architecture documentation for IPC sender verification and window navigation confinement.Risk Assessment
Testing
Removed untracked tests/live-update-ipc-sender-validation.cjs per operator guidance, recompiled backend with npm run build, and validated all sender checks, payload guards, and window navigation restrictions via npm run test:update-ipc-sender-validation and related suites with 100% pass rate.
Evidence: Update IPC sender validation test suite output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
main/updater-shutdown.ts:89- The validateSender option on RestartAndInstallOptions (main/updater-shutdown.ts:29) and its validation branch (main/updater-shutdown.ts:89) introduce an unrequired component that duplicates sender validation. The user intent ('validate sender on direct update IPC handlers and restrict window navigation (Update IPC handlers accept untrusted senders for preference changes and downloads (ARCH-007c) #1184)') is already satisfied at the IPC dispatch boundary in createDirectUpdateIpcHandlers (main/update-ipc.ts:184-187), which uniformly validates senders for all 10 direct update IPC handlers including 'restart-and-install'. Wiring validateSender into createRestartAndInstallHandler in main/index.ts:1517 causes the exact same sender validation to run twice in series for every restart-and-install call. The recommended remedy is to remove the validateSender option and branch from createRestartAndInstallHandler and its wiring in main/index.ts, relying on the IPC handler boundary in update-ipc.ts.🔧 Fix applied.
1 warning still open:
main/updater-shutdown.ts:89- The validateSender option on RestartAndInstallOptions (main/updater-shutdown.ts:29) and its validation branch (main/updater-shutdown.ts:89) introduce an unrequired component that duplicates sender validation. The user intent ('validate sender on direct update IPC handlers and restrict window navigation (Update IPC handlers accept untrusted senders for preference changes and downloads (ARCH-007c) #1184)') is already satisfied at the IPC dispatch boundary in createDirectUpdateIpcHandlers (main/update-ipc.ts:184-187), which uniformly validates senders for all 10 direct update IPC handlers including 'restart-and-install'. Wiring validateSender into createRestartAndInstallHandler in main/index.ts:1517 causes the exact same sender validation to run twice in series for every restart-and-install call. The recommended remedy is to remove the validateSender option and branch from createRestartAndInstallHandler and its wiring in main/index.ts, relying on the IPC handler boundary in update-ipc.ts.git -C ~/.no-mistakes/worktrees/de2296f2e6f8/01M54G3PW2S1V1H1GTGFDN9YXX statusandgit -C ~/.no-mistakes/worktrees/de2296f2e6f8/01M54G3PW2S1V1H1GTGFDN9YXX diff). Respond with fix to validate it, or abort.🔧 No changes applied.
1 warning still open:
npm run buildnpm run test:update-ipc-sender-validationnpm run test:titlebar-window-optionsnpm run test:url-allowlistnpm run test:script-coverage✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.