Skip to content

fix(main): validate sender on direct update IPC handlers and restrict window navigation - #1200

Merged
khaira777 merged 3 commits into
mainfrom
fix/1184-update-ipc-sender-validation
Oct 17, 2026
Merged

khaira777 merged 3 commits into
mainfrom
fix/1184-update-ipc-sender-validation

Conversation

@khaira777

Copy link
Copy Markdown
Contributor

Intent

validate sender on direct update IPC handlers and restrict window navigation (#1184)

What Changed

  • Enforced sender validation across direct update, status, and theme IPC handlers via isTrustedMainWindowSender in main/update-ipc.ts and main/ipc.ts, rejecting requests from non-main windows, unexpected frames, or unverified origins.
  • Restricted main window navigation by registering createMainWindowWillNavigateHandler on will-navigate, confining in-window navigation to allowed local URLs, delegating safe external URLs to the default system browser via shell.openExternal, and blocking unsafe schemes.
  • Added comprehensive unit tests in tests/update-ipc-sender-validation.test.ts and updated desktop architecture documentation for IPC sender verification and window navigation confinement.

Risk Assessment

⚠️ Medium: The change cleanly enforces IPC sender validation and restricts main window navigation with thorough behavioral test coverage, with a minor simplification opportunity to remove a redundant secondary sender check in updater-shutdown.

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.

  • Live validation: ⚠️ inconclusive - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Legitimate main window sender successfully invokes direct update IPC handlers ⏸️ untested no Prior payload validated this scenario via unit tests (npm run test:update-ipc-sender-validation) with live=false; it did not establish a live result against the running product.
Adversarial/unauthorized sender is rejected from invoking direct update IPC handlers ⏸️ untested no Prior payload validated this scenario via unit tests (npm run test:update-ipc-sender-validation) with live=false; it did not establish a live result against the running product.
Malformed argument types sent to direct update IPC handlers are safely rejected ⏸️ untested no Prior payload validated this scenario via unit tests (npm run test:update-ipc-sender-validation) with live=false; it did not establish a live result against the running product.
Main window navigation restricts external and unsafe URLs while allowing local app routes ⏸️ untested no Prior payload validated this scenario via unit tests (npm run test:update-ipc-sender-validation) with live=false; it did not establish a live result against the running product.
Evidence: Update IPC sender validation test suite output
--- Testing isTrustedLoopbackUrl ---
✓ isTrustedLoopbackUrl passes all boundary checks
--- Testing isTrustedMainWindowSender ---
✓ isTrustedMainWindowSender enforces window identity, frame token, and loopback origin
--- Testing Direct Update IPC Handlers ---
✓ All 10 handlers reject remote, wrong-host, wrong-port, other-window, and stale-frame senders
--- Testing legitimate sender execution & arguments ---
✓ All 10 handlers succeed for legitimate senders and reject malformed arguments
--- Testing restartAndInstallHandler readiness & PIN guards ---
✓ restartAndInstallHandler readiness and PIN guards enforce proper precedence
--- Testing registerDirectUpdateIpcHandlers registration ---
✓ registerDirectUpdateIpcHandlers wires all 10 channels
--- Testing createMainWindowWillNavigateHandler ---
✓ createMainWindowWillNavigateHandler confines local app navigation and delegates external URLs safely

✅ All update IPC sender validation and window navigation tests passed successfully.
- Outcome: ⚠️ 1 warning across 2 runs (40m56s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 warning
  • ⚠️ 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.
⚠️ **Test** - 1 warning
  • ⚠️ The Test agent did not finish within its invocation budget. Reported: agent run tests timed out after 30m0s: agent last produced output 710ms ago (205 observed); agent reported: antigravity parse events: context deadline exceeded. This is a budget or provider-slowness cut, not a code failure. Re-running the same request costs another full budget, so no further attempt is made automatically. If this repository's targeted tests or evidence gathering routinely approach the default 30m0s, raise test_agent_timeout in global config. Respond with fix to spend another budget: a repair turn runs only for selected findings other than this budget cut, then validation re-runs. Or abort and retry after raising the budget.
  • 🚨 Approval is refused: the run worktree at ~/.no-mistakes/worktrees/de2296f2e6f8/01M54G3PW2S1V1H1GTGFDN9YXX holds work no Test turn validated, and the steps after Test would commit and publish it. It holds uncommitted changes to tests/live-update-ipc-sender-validation.cjs (inspect with git -C ~/.no-mistakes/worktrees/de2296f2e6f8/01M54G3PW2S1V1H1GTGFDN9YXX status and git -C ~/.no-mistakes/worktrees/de2296f2e6f8/01M54G3PW2S1V1H1GTGFDN9YXX diff). Respond with fix to validate it, or abort.

🔧 No changes applied.
1 warning still open:

  • ⚠️ live validation verdict: inconclusive (0 of 4 scenarios were driven live against the product); untested: Legitimate main window sender successfully invokes direct update IPC handlers, Adversarial/unauthorized sender is rejected from invoking direct update IPC handlers, Malformed argument types sent to direct update IPC handlers are safely rejected, Main window navigation restricts external and unsafe URLs while allowing local app routes
  • Live validation: ⚠️ inconclusive - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Legitimate main window sender successfully invokes direct update IPC handlers ⏸️ untested no Prior payload validated this scenario via unit tests (npm run test:update-ipc-sender-validation) with live=false; it did not establish a live result against the running product.
Adversarial/unauthorized sender is rejected from invoking direct update IPC handlers ⏸️ untested no Prior payload validated this scenario via unit tests (npm run test:update-ipc-sender-validation) with live=false; it did not establish a live result against the running product.
Malformed argument types sent to direct update IPC handlers are safely rejected ⏸️ untested no Prior payload validated this scenario via unit tests (npm run test:update-ipc-sender-validation) with live=false; it did not establish a live result against the running product.
Main window navigation restricts external and unsafe URLs while allowing local app routes ⏸️ untested no Prior payload validated this scenario via unit tests (npm run test:update-ipc-sender-validation) with live=false; it did not establish a live result against the running product.
  • npm run build
  • npm run test:update-ipc-sender-validation
  • npm run test:titlebar-window-options
  • npm run test:url-allowlist
  • npm run test:script-coverage
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: FreeOpenSourcePOS/FloCafe/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e1cd1cac-17e3-48db-9621-d88366dcdf18

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@khaira777
khaira777 merged commit 13a6378 into main Oct 17, 2026
23 checks passed
@khaira777
khaira777 deleted the fix/1184-update-ipc-sender-validation branch October 17, 2026 09:41
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.

1 participant