Repository navigation
Conversation
…rt (STA-7672) buildRepairScript wrote the Allow rule with -LocalPort <port> for whichever port happened to be bound when the user ran repair, but the desktop's listen port is not stable. A persisted mobile-ws-fallback-port.json (preferred over the pinned port for STA-1511), a pairing widen rebind, or an OS-assigned port all move it, and nothing reconciled the rule with the new bind. The phone then knocked on a port the firewall did not cover and LAN/direct pairing failed with no diagnosis pointing at the firewall. The Allow rule is now written with -LocalPort Any. Inspection already accepted 'Any' (buildInspectionScript matches -eq 'Any' -or -eq '<port>'), so the two halves can no longer desync. The rule stays scoped to this program, the Private profile, and -EdgeTraversalPolicy Block; the port still scopes which conflicting Block rules the repair removes. The port drift itself is cross-platform, but only Windows writes a per-port permission: macOS approves per app and Linux does not filter inbound LAN traffic by default.
|
Warning Review limit reachedNext included review available in 11 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
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 |
There was a problem hiding this comment.
ℹ️ No critical issues — the fix is sound; one stale-copy follow-up inline.
Reviewed changes
- Port-agnostic Allow rule —
buildRepairScriptnow emits-LocalPort Anyfor theOrca.MobilePairingrule instead of the port bound at repair time (src/main/runtime/windows-mobile-firewall.ts:235), with a comment explaining the drift (persisted fallback, pairing widen rebind, OS-assigned port). - Tests — replaced the pinned-port assertion with coverage that the new rule is port-agnostic while still program/Private/TCP/edge scoped, that
portstill scopes the Block-rule removal, and that the inspection predicate acceptsAnyfor drift ports.
The root cause and the broadening trade-off both check out: the Allow rule stays scoped to this program, the Private profile, and -EdgeTraversalPolicy Block, and inspection already accepted LocalPort 'Any', so the written rule and the check agree. The only gap is the user-facing wording, noted inline.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| } | ||
| Get-NetFirewallRule -Name ${quotePowerShell(FIREWALL_RULE_NAME)} -ErrorAction SilentlyContinue | Remove-NetFirewallRule | ||
| New-NetFirewallRule -Name ${quotePowerShell(FIREWALL_RULE_NAME)} -DisplayName ${quotePowerShell(FIREWALL_RULE_DISPLAY_NAME)} -Description 'Allows Orca Mobile to connect to this Orca desktop on private networks.' -Direction Inbound -Action Allow -Enabled True -Profile Private -Protocol TCP -LocalPort ${port} -Program ${quotePowerShell(executablePath)} -EdgeTraversalPolicy Block | Out-Null` | ||
| New-NetFirewallRule -Name ${quotePowerShell(FIREWALL_RULE_NAME)} -DisplayName ${quotePowerShell(FIREWALL_RULE_DISPLAY_NAME)} -Description 'Allows Orca Mobile to connect to this Orca desktop on private networks.' -Direction Inbound -Action Allow -Enabled True -Profile Private -Protocol TCP -LocalPort Any -Program ${quotePowerShell(executablePath)} -EdgeTraversalPolicy Block | Out-Null` |
There was a problem hiding this comment.
-LocalPort Any is the right shape for a program-scoped rule, but the user-facing copy still describes a port-scoped one, so the notice now misstates the firewall's actual scope. WindowsFirewallNotice tells the user the action "allows port {{port}}" and to add "TCP port {{port}}" — neither matches the rule this button now writes.
Technical details
# Stale firewall copy after the Allow rule stopped being port-pinned
## Affected sites
- `src/renderer/src/components/mobile/WindowsFirewallNotice.tsx:170` — `blocked-description` fallback: "...then allows port {{port}} on Private networks."
- `src/renderer/src/components/mobile/WindowsFirewallNotice.tsx:175` — `missing-description` fallback: "Add a rule for this Orca app and TCP port {{port}}..."
- `src/renderer/src/i18n/locales/en.json:13928,13934`, `es.json:12097,12103`, `fr.json:13340`, `ko.json:12140,12146`, `ja.json:12097,12103`, `zh.json:12177,12183` — same two strings in every catalog, so the code fallback alone will not change what users see.
## Required outcome
- Copy should stop promising a single port for the rule the repair button writes. `firewallStatus.port` still describes the live pairing endpoint the phone dials, so it can remain if the wording is about connecting to Orca rather than the rule's scope (e.g. drop "and TCP port {{port}}" from `missing-description`, and "then allows port {{port}}" from `blocked-description`).|
Closing unmerged — the fix buys less than I priced it at, and it is a security widening. The existing code already recovers from this case. So The two cases the notice does not cover are the This also corrects the framing this ticket started with: the port drift explains the "nothing listening on 6768" observation, but it is not a standalone broken path. #21076 (the relay half-open socket) is the real defect. Port-drift analysis preserved for a follow-up ticket; branch left in place. |

ELI5
Orca normally listens on port 6768. When it asks Windows for firewall permission, the rule it creates says "allow traffic on port 6768."
But Orca doesn't always stay on 6768 — if something else grabs that port, it moves to 6769 and remembers that choice permanently. Now the firewall is guarding a door Orca no longer uses, so the phone knocks and Windows blocks it.
The rule now says "allow traffic to the Orca app" instead of naming a port, so Orca can move and the firewall follows.
What Changed
One line in
buildRepairScript: the Allow rule is written with-LocalPort Anyinstead of the port that happened to be bound when the user ran repair. Plus a comment explaining why, and two tests.Why
buildRepairScriptwrote-LocalPort <port>for whichever port was bound at repair time, but the desktop's listen port is not stable:mobile-ws-fallback-port.json, whichws-transport.tsprefers over the pinned port forever (deliberately, for STA-1511 — devices paired while the fallback was active would otherwise strand)runtime-rpc-network-exposure.ts)Nothing reconciled the rule with the new bind. The phone then knocked on a port the firewall did not cover, and LAN/direct pairing failed with nothing pointing at the firewall as the cause.
Inspection was never the problem — it reads the live endpoint via
getWebSocketEndpoint()and already accepted'Any'(buildInspectionScriptmatches-eq 'Any' -or -eq '<port>'). Only the written rule was pinned, so making it port-agnostic closes the desync permanently.The rule stays scoped to this program, the Private profile, and
-EdgeTraversalPolicy Block. The port still scopes which conflicting Block rules the repair removes. This is the same shape Windows itself creates when it auto-prompts "allow this app through the firewall."Why not fix the port drift instead. Preferring the pinned port once it is free again would regress STA-1511. With the rule no longer port-pinned, the drift no longer breaks pairing — the QR carries the live endpoint. Worth its own ticket, not a drive-by flip.
The drift itself is cross-platform, but only Windows writes a per-port permission: macOS approves per app, and Linux does not filter inbound LAN traffic by default. Hence a Windows-only change for a cross-platform root cause.
Linked Issue
STA-7672 — https://linear.app/stably/issue/STA-7672
Split out of the same ticket as #21076 (the relay half-open socket defect). The reporter hit both at once; they are independent and land separately.
Visual Proof
N/A — no UI change. The
WindowsFirewallNoticecopy, trigger conditions, and rendering are untouched; only the PowerShell the repair button generates changed.Testing
pnpm tc,oxlint, andpnpm run check:code-quality:changedclean.windows-mobile-firewall.test.ts+mobile.test.ts: 55 passed.New coverage:
Verified against a live Windows firewall (Windows host running 1.4.204, the build from the report), read-only and
-WhatIfonly — no rule was created or modified:LocalPortvalue for a port-agnostic ruleAny,System.StringTrue/True/TrueNew-NetFirewallRuleline with full production parameter set,-WhatIfThat closes the real risk — that
-LocalPort Anymight serialize to something inspection would not match, silently breaking the check it is meant to satisfy.Still unverified: actually creating the rule needs UAC elevation, and end-to-end phone pairing needs a physical device. Neither was done. A reviewer with an elevated Windows session should confirm the repair button produces a working rule and that pairing survives a port change.