Repository navigation
fix(electron): gate app-menu IPC per-action for remote gateway senders - #13040
Conversation
|
Intent: Add a per-action security gate at the Electron |
d49f6a5 to
4e33bf0
Compare
UX Review (Opus 5.5, fork) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing the refused-click notice at this revision. The only image of it (attachment-08) shows different copy and no "Ask the agent" button, so the notice that actually ships has not been shown. Evidence gaps
Notes
[UX-REVIEWED] 2a81d37 Description read[DESCRIPTION-READ] 35ff4e9ddb2a98eec54f71f7e0c1020addeaa457f2dd82bf184975c7ba26c4b6 That sha256 names everything this verdict read: the PR description, plus the 11 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: the per-action fence is a derived fix at the untrusted-remote-content boundary. The trouble is the extra paint machinery stacked on top of it. Notes
What this change shipsInventory (10 items) — 8 justifiedIntent: keep a remote gateway page in a connection window from using the Windows titlebar menu to drive local privileged actions. FIX.
[FIRST-PRINCIPLES-REVIEWED] 2a81d37 Description read[DESCRIPTION-READ] c8376d9a66ba1e353d9b5550a32baeff50b9d4c4dc54d4884cc4fdeb4047eed7 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS No design problem blocks this: the per-action gate sits at the only renderer-reachable menu path and fails closed. The risks below can all be reversed. Notes
[DESIGN-REVIEWED] 2a81d37 Description read[DESCRIPTION-READ] 80a3f239605a02057eaba3d3316485a3d9b0c2612416572f491ad3da478446d4 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review (fork) — 🔴 changes requested (blocking)Reviewed 1 of 2 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands. BLOCKING -- website/electron/ipc-registrar.js:766 -- Compare the focused WebContents before delayed dispatch
BLOCKING -- website/src/components/WindowsTitlebarMenu.tsx:307 -- The shell-wide hand-off discards unsaved page drafts
[BLOCK-MERGE] 2a81d37 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F2: This finding is tied to the rule F1 (fenced): The netstat probe can take up to 10 s per attempt, with retries ( |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
cb4c402 to
1f38294
Compare
1f38294 to
fb3e319
Compare
fb3e319 to
9ef4081
Compare
|
@iamwhatever your review is pinned to
Tests for an unknown probe and a probe with no named owner are in Your owner decision (keep per-action, drop the glyph and strike-through, keep a short footer) is not applied yet. That is a visible UI change, so I am leaving it for the author or a maintainer to confirm. |
|
@bolichen97 thank you for both pushes — the merge that cleared the conflict, and the paint/probe fix. Two things you should know, the first because it undoes a courtesy you deliberately extended. I rebased the branch, so your commit has a new SHA. You wrote "no rebase, no force-push" twice, and I have now done the opposite to your work, so I would rather state it than let you discover it. Your fix is byte-identical after the replay — The reason is the gate your merge commit tripped. The rebase exposed one defect, and it is the merge-order hazard you flagged in triage. Upstream added a View item @iamwhatever's owner decision is applied. Per-action design kept, glyph and strike-through dropped, footer short. The footer states both halves — the rows are unavailable here, and some keyboard shortcuts still work — because Electron's native accelerator dispatch bypasses the app-menu IPC gate, so One question back. Screenshots and the footer geometry are stale; I am re-capturing on Windows along with the behavioural checks your fix needs — paint-without-waiting, a refused click on an inconclusive probe, and the 35s boundary — since you noted you have no Windows machine. Locally green: electron 2499 tests / 0 fail, renderer 28/28, The force-push will re-arm the fork approval gate, so the five workflows will need approving again when you have a moment. — AI comment by Agent(Cyborg) |
|
Status, and one ask. Since my last comment the branch moved twice, both times by amending my own commit, so @bolichen97's commit has a new SHA again: First Principles' blocker. It asked for three deletions. The wire field UX's footer. It blocked the two-sentence footer as too vague, then blocked the one-sentence footer as wrong advice. The resolution is subtraction rather than annotation: a gated row whose chord cannot fire now ships First Principles item 5, with the number it asked for. The port-owner probe costs 594–739ms on Windows across five runs, The ask: please re-run the On UX's two Watch items, they conflict with each other. Watch 1 wants the footer to name the main window as the remedy; Watch 2 observes that the footer renders in the main window when gate 3 cannot confirm the gateway, and capture 7 is a photograph of exactly that. The shipped string is the only wording true in both states, so I would rather say so than patch one and break the other. — AI comment by Agent(Cyborg) |
|
@iamwhatever @buluoray could you re-review at What changed against the two blocking points:
One open point for you to weigh: during that inconclusive window the main window's Paste/Quit/Settings rows look enabled, but a click is refused with no feedback. Before this PR the main window's menu did not depend on the port probe at all. Please say whether that is acceptable or needs a change before merge. UX Review is red because its verdict was formed before the new screenshots were added; it needs a re-run of |
|
Rebased and force-pushed — the PR had gone New head for review: The conflict was in @bolichen97's commit was replayed byte-identical (same 263/23 diffstat, authorship intact); only the base and the SHAs moved. -- AI comment by Agent(Cyborg) |
|
Force-pushed again — New head for review: Split rather than baselined, per AGENTS.md. The @bolichen97's commit replayed with the same 263/23 diffstat and its -- AI comment by Agent(Cyborg) |
buluoray
left a comment
There was a problem hiding this comment.
Request changes at cb31d4f.
Thanks for the follow-up commit. Painting from a lapsed positive, refusing clicks on an inconclusive probe, revoking on a proven foreign holder, and the reworded footer all move in the right direction, and the new tests pin each one: mutating each new guard turned a test red. Two gaps remain, one under each earlier blocking point.
Blocking 1, partly cleared: past 35 seconds the menu still waits on the probe
resolveSenderIsLocalForPaint paints from the last positive only while positiveIsPaintable holds (website/electron/ipc-registrar.js:355-359), which is POSITIVE_VERDICT_TTL_MS + INCONCLUSIVE_PAINT_GRACE_MS, 35s from the last mint. After that the paint awaits the full probe (ipc-registrar.js:503). In a harness test with a probe that never settles, a paint after 10s returns at once, and paints after 36s, 60s and 300s all wait. The Windows measurements in the description agree: rows land at 903 to 1191 ms on every open taken more than 35s apart. Most menu opens come after a gap longer than 35s, so the local Windows user still sees an empty popup for about a second on most opens, and ArrowDown has nothing to land on.
To clear: separate the paint lifetime from the inconclusive grace. For example, paint from the last positive at any age with a background re-probe, and drop it only on navigation or a proven foreign holder; the grace then applies only when the latest probe was inconclusive. Alternatively, paint from gates 1 and 2 alone and keep gate 3 on the execute path, as Design Review suggests. Add a test with a gap well past 35s and a probe that never settles.
Blocking 2, partly cleared: a failed command lookup still counts as a foreign holder
unknown and none are now inconclusive (ipc-registrar.js:341), but the case the comment at ipc-registrar.js:333-334 names, a PowerShell timeout, produces neither. When the netstat step succeeds and both the PowerShell and WMIC lookups fail, windowsProcessCommand returns an empty string (website/electron/windows-port.js:243), and classifyPortOwner then reports foreign (website/electron/gateway-stop.js:801-813). settleProbeOutcome drops the positive and the local main window greys at once, with no grace. A direct run confirms it: a failed exec gives an empty command, which is classified as foreign.
To clear: classify a holder whose command line could not be read as unknown, at least on the app-menu path, with a test. For the from-source venv owner that the description confirms greys every LOCAL_ONLY row in the main window: either fix the trust here (the pyvenv.cfg route in Follow-up 2 looks small), or state in the description that this build is an accepted break for this PR and add a test with a venv-shaped owner that pins the chosen behaviour.
Non-blocking, still open
- Two mutations still stay green: removing the generation guard (
ipc-registrar.js:329), and defaultingexecuteMenuItemto local (website/electron/windows-menu-model.js:261). - The classification is still a deny list (
windows-menu-model.js:169-172), so an unknown leaf defaults to allowed. docs/build/desktop-app.mdstill does not describe the app-menu gate next to thewsl:detectand folder-picker gates.- UX Review on this head: put the footer
max-w-[240px]on an inner span so its top border spans the popup.
Checked and fine
The rebase onto ea45e802e9 (glyph removal, footer rewording, the focus-mode-toggle fence, the empty caption for gated rows whose chord does not fire, the test split). Related test files pass on this head (ipc-registrar 42, sender-locality 16, windows-menu-model 16, titlebar contract 5, WindowsTitlebarMenu 28). The one CI failure, Backend Tests (Windows) (1) in test/test_ci_ipv6_routing.py, is the known flake #21943 and unrelated to this diff.
Not run on Windows. Blocking 2 is from source plus a direct run of the classifier; for Blocking 1 the description's own Windows timings back the harness result.
|
@bolichen97 Blocking 1 sits in your commit rather than mine — The ask is to separate the paint lifetime from the inconclusive grace: paint from the last positive at any age with a background re-probe, drop it only on navigation or a proven foreign holder, and apply the 30s grace only when the latest probe was inconclusive — plus a test with a gap well past 35s and a probe that never settles. AGENTS.md caps this PR at two commits so a third isn't an option. Would you rather push that yourself, or shall I amend your commit? Happy either way, just say which. Blocking 2 is addressed on my commit locally and goes up with the next push: an unreadable command line now classifies as -- AI comment by Agent(Cyborg) |
|
Rebased and force-pushed — the PR had gone New head for review: The conflict was in @bolichen97 your commit's content changed this time, not just its SHAThe three earlier rebases replayed it byte-identical. This one does not, for three reasons:
Your commit is 554/25 where it was 263/23. Authorship and the 8 Oct date are intact, and each commit passes the electron suite alone. Blocking 2, and three security defects it surfacedBlocking 2 asked that a probe hiccup not grey a local menu. Classifying an unreadable command line as
Fixed with a distinct The open feedback point is closedYou flagged that during the inconclusive window a row looks enabled but the click is refused with no feedback, and asked whether that was acceptable before merge. It is now answered in code: One residual, disclosed in
|
|
Pushed the two New head for review: F1 — F2 — a refusal inside the inconclusive paint grace was silent: the row stayed enabled and nothing explained why. Now surfaces an Also rebased onto -- AI comment by Agent(Cyborg) |
|
Rebased onto The conflict was move-versus-modify: this PR extracts that file's shared constants and harness into New head: @bolichen97's commit is unchanged — 554/25, identical patch-id, new SHA only from the replay. |
|
Pushed the one finding both review lanes blocked on. Opus 5.5 and GPT 6.1 flagged the same defect independently: this PR made
New head: Also rebased onto |
|
@josej4m thanks for the latest push. One blocker is left on head When a WebContents switches from a local page to a remote one while the old page's locality probe is still pending, the remote page can join that probe. If it settles as The finding is security-class, so it can't be overridden. It needs a code fix:
A test for that sequence (navigate local to remote mid-probe, probe returns @buluoray's two points from the 10-20 review are still open as well. |
|
Heads up before the next force-push: this round changes the content of What forced it. The pre-push GPT lane raised a blocking DoS against the fix What changed. A retrospective ruled the repair had to be a narrowing, so the
Generation equality still applies to the verdict through What the strict read actually costs, since it lands in behaviour. Less than Commits. Two, as before. Authorship and the 8 Oct author date are preserved
Both local lanes return no findings on the pushed tree, and both commits pass the -- AI comment by Agent(Cyborg) |
|
Correction to the SHAs in my previous comment. The branch was rebased onto
The rest of that comment stands unchanged, including the part that matters most My sequencing error: the rebase belonged before the comment, not after it. -- AI comment by Agent(Cyborg) |
|
Status from the crew (iamwhatever): I approved the pending fork workflow runs (the diff touches no First Principles is BLOCK on this head. It asks to remove the verdict cache, the 30s paint grace and the
@buluoray please re-review on |
|
Pushed The First Principles override draft from my previous comment now needs the new head: |
|
Conflict cleared and the branch is current again at What conflicted. One file, @bolichen97 your commit SHA moved again ( Two asks, because nothing has actually run here since 5 November.
|
|
Both asks are done. The branch is rebased onto Re-authored. It is now a single commit authored by me, with @bolichen97 and @iamwhatever as One disclosure. In Electron suite 3797 tests / 0 fail; the titlebar and dirStaging frontend suites 105 / 0; both i18n gates and the frontend build clean. One ask: 17 fork workflow runs are sitting at |
|
@buluoray, the points from your change request on
CI on this head is still running. AI-assisted, sent by CommunityCrew |
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 20% chance that this change introduces a defect, above the 12% limit for approving on its own. The PR adds a per-action, fail-closed gate on the Windows titlebar menu IPC. Clicks are only treated as local when a fresh check (or one under 5s old) proves the sender is the local dashboard; a navigation clears the cached answer. Painting rows from an older answer only affects how they look, since every click is checked again. Every menu item is classified into a local-only set or left remote-safe, and a test walks the whole menu to keep that true. The new 'unidentified' port-owner value is handled correctly by every reader: adoption and auth-hint refuse it like 'foreign', the restart handoff refuses it as unverifiable, and eviction/reconnect behave as before. The renderer copes with older shells that still use An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
The Electron app-menu IPC channel (`app-menu:items` / `app-menu:execute`) was gated per-channel via `assertLocalDashboard`, letting through anything a local dashboard could issue. A remote gateway page loaded in a connection window shares the same preload, so it could invoke privileged menu roles (paste reads the OS clipboard, quit terminates the app, close/minimize/zoom mutate OS window state, togglefullscreen covers the desktop) plus custom-click items (DevTools opens on the local dashboard, Settings/About windows). Classify menu items into four sets — LOCAL_ONLY_ROLES, LOCAL_ONLY_MENU_IDS, LOCAL_ONLY_ITEM_IDS, REMOTE_SAFE_ITEM_IDS — and enforce them at `executeMenuItem` when the sender is not local. Thread `senderIsLocal` down from the IPC boundary through `menuItems` and `executeMenu` so `app-menu:items` also advertises LOCAL_ONLY rows as `enabled: false` for a remote sender — a rendered row must not silently no-op on click. Resolve the verdict once per WebContents via a WeakMap cache invalidated on `did-navigate` to keep the per-click cost sub-ms. Add a template-walk drift pin that walks `buildMenuTemplate` output for both isMac branches, filters by `WINDOWS_TITLEBAR_MENU_IDS` reachability, and asserts every reachable leaf is classified in exactly one set. This catches an unclassified item added to `app-menu.js` that a set-membership pin alone would miss. Windows-only enforcement is deliberate: the `app-menu:*` IPC is the only renderer-invocable menu path (Linux/macOS use the native OS menu with no renderer API, and custom click handlers resolve to `focusedDashboardWebContents()` which finds the dashboard view, not remote content). The classification sets are the global policy; the enforcement point is single because the attack surface is single. A gated row carries no per-row decoration and the payload carries no accelerator-registration field. Greying states the row is inert from this window, and the footer adds the one thing greying cannot say: the shortcuts still shown do fire, because Electron's native accelerator dispatch and Chromium's own clipboard handling both bypass this IPC. That sentence is kept true by subtraction rather than annotation. `serializeMenuItems` blanks the caption of a gated row whose chord cannot reach its command, which is File > Settings… alone — `registerAccelerator: false` displays Alt+, without binding it, and the in-page handler that does route it only receives the keystroke while the dashboard page holds focus. So the wire carries an existing field with a narrower value rather than a new flag no consumer reads. One renderer test pins the absence of any per-row marker, one wire test pins the suppression, and one pins the absence of the field. Paint the menu without waiting on the port probe. A lapsed positive verdict paints `app-menu:items` at once and re-probes in the background; `app-menu:execute` still refuses unless a fresh probe proves a local owner, so the click stays the real gate. A probe that cannot name the primary-port holder (unknown, or none while our gateway restarts) keeps the rows painted enabled for a restart-sized grace instead of greying the local window's own menu, but never authorizes an action. Past the grace the rows grey with the footer. A proven foreign holder revokes the positive, and a first call still fails closed. `classifyPortOwner` gains `unidentified` for a holder that demonstrably exists but whose command line could not be read. `unknown` means the probe never ran, so nothing is known to hold the port and the adopt path may fail open; here a holder exists and only its identity is missing, so the adopt path refuses it exactly as it refuses `foreign`, while the app-menu gate reads it as inconclusive rather than as a proven foreign holder. That is what stops a transient probe failure from revoking the local user's own menu rows. Off macOS the Window menu's Zoom is a custom click calling `applyWindowControl(win, "maximize-toggle")` rather than Electron's macOS-only `zoom` role, so it carries no role for `LOCAL_ONLY_ROLES` to catch and would have inherited remote-safe on execute. It is fenced by id as `window-zoom`, and the template-walk pin is what found it. Co-authored-by: Bolin Chen <bolichen@amazon.com> Co-authored-by: Joe Guo <12429733+iamwhatever@users.noreply.github.com>
A page could pass an app-menu id whose own toString throws. Building the focus-moved refusal line called it, so the throw skipped the per-sender budget and every queued invoke wrote its own dispatch-failed line. Render renderer-supplied ids by type instead of coercing them, and send the dispatch-error line through the same budget.
The focus-moved check compared windows, so a modal opened inside the same window moved the focused WebContents unnoticed and a Reload then hit the modal. Compare the focused WebContents too. The refusal notice covers the whole shell, so its ask-the-agent hand-off could unmount a page holding unsaved drafts. Turn it off, as errors-use-error-notice requires.
Problem / Motivation
Goal: A remote gateway page shown in a connection window can no longer drive privileged local actions — quitting the app, reading the OS clipboard, opening Settings or DevTools — from the Windows titlebar menu.
A remote gateway page loaded in a connection window shares the Electron preload with the local dashboard. Nothing at the IPC boundary stopped it from calling
getAppMenuItemsandexecuteAppMenuItem, so a hostile or compromised gateway could reach menu roles that operate outside its own document —pastereads the local OS clipboard,quitterminates the app,close/minimize/zoommutate the OS window the remote is drawn in,togglefullscreencovers the whole desktop. Custom-click items were reachable too:Toggle DevToolswould open DevTools on the local dashboard's origin, and Settings/About windows would open under the local process.Why it matters
Connection windows exist so a user can look at remote content while keeping their local dashboard next to it. The trust boundary is the origin: the local gateway is trusted, a remote gateway is not. Without a per-action gate at the IPC boundary, that boundary was enforced only by the channel-level
assertLocalDashboardcheck — which was gated per-CHANNEL, not per-ACTION. A remote sender that reached the channel at all reached every action on it.Not a goal
app-menu:*is the only path a remote sender can reach; enforcement is Windows-only by design, not by omission.update:check/download/install/set-channel/set-auto-download, andlocal-gateway:set). Named in the Scope note below and tracked under Follow-ups.windows-port.js, in the probe this PR consumes; tracked under Follow-ups.What changed (motivation → approach → change)
sequenceDiagram autonumber participant R as Remote gateway page participant B as Preload bridge (shared) participant I as ipcMain handler participant M as executeMenuItem Note over R,M: BEFORE — channel-only gate R->>B: executeAppMenuItem("edit-menu", 2) B->>I: send("app-menu:execute") I->>M: dispatch (per-CHANNEL gate only) Note right of M: no per-action fence past the channel<br/>a race or added local-adjacent path<br/>reaches the model with no LOCAL_ONLY check Note over R,M: AFTER — per-action fence R->>B: executeAppMenuItem("edit-menu", 2) B->>I: send("app-menu:execute") I->>I: resolveSenderIsLocal(sender)<br/>WeakMap cache miss → probe → false<br/>cache verdict, wire did-navigate invalidation I->>M: executeMenu(sender, id, index, senderIsLocal=false) M-->>R: refuse (LOCAL_ONLY_ROLES.has("paste") ∧ !senderIsLocal) Note right of M: log entry, no dispatch<br/>serializeMenuItems also paints enabled:falseApproach. The IPC boundary already resolves whether the sender is local (
assertLocalDashboard: origin + local-gateway + primary-port-owner). Thread that verdict down as a per-action gate, and reflect it on the items surface so a rendered menu row cannot silently no-op when clicked.Change.
windows-menu-model.jsclassifies every menu leaf into one of three positive-membership sets —LOCAL_ONLY_ROLES,LOCAL_ONLY_MENU_IDS,LOCAL_ONLY_ITEM_IDS. Anything not in the sets is remote-safe by default; there is no fourth allowlist (an earlier draft carried aREMOTE_SAFE_ITEM_IDSset for symmetry, removed in a later push once it proved to have zero consumers).executeMenuItemrefuses a LOCAL_ONLY leaf whensenderIsLocal !== true(strict fail-closed).serializeMenuItemsreflects the same verdict asenabled: falseon the items surface, so the row exists but cannot be clicked.ipc-registrar.jsresolves the verdict once per WebContents via aWeakMapcache invalidated ondid-navigateand expiring after 5s, so per-click cost stays sub-ms without letting a positive outlive the mutable fact behind gate 3 (see Positive-verdict expiry below).dev-mode-changedpicks up the same gate, read strictly: only a proven local owner may flip the DevTools row's visibility. The direction that matters is HIDE rather than show —app-menu.jsbuilds that rowvisible: true, so a refusal leaves it visible and what the gate prevents is a remote sender hiding the local user's row. A template-walk drift pin walksbuildMenuTemplateoutput for both isMac branches and asserts every reachable leaf is either classified into one of the three sets or accepted as remote-safe.Windows-only enforcement is deliberate. The
app-menu:*IPC is the only renderer-invocable menu path — Linux and macOS use the native OS menu, which has no renderer API. Custom click handlers already resolve tofocusedDashboardWebContents(), which walks the focused window'scontentViewchildren to find the dashboard view, never remote content. The three sets are the global policy for the app-menu IPC surface; the enforcement point is single because the menu attack surface is single. If a Linux frameless custom titlebar menu ever ships, it plugs intoexecuteMenuItemwithsenderIsLocaland inherits the same sets.Scope note (menu-only). This PR closes the per-action gap on
app-menu:*. It does NOT gate every non-menu preload channel a remote sender can reach — 6 in particular (update:check/update:download/update:install/update:set-channel/update:set-auto-download, pluslocal-gateway:set) remain ungated byassertLocalDashboardon base, soupdate:installin particular could still be used by a remote sender to terminate the local app. Closing those is out of scope for this PR and is called out here so a reader auditing the "attack surface is single" phrasing above sees it named rather than implied to be fixed. Tracked as a follow-up — see Follow-ups at the bottom of this description.Rejection-log throttle.
glogis an unrotated synchronousfs.appendFileSyncon the main thread and the gate writes one line per rejection. Two of the three channels this PR routes through the gate are fire-and-forgetipcRenderer.sendpaths (app-menu:execute,dev-mode-changed), so a remote page loops them at renderer speed with no backpressure — unlike every pre-existing gated channel, each of which is an awaitedipcRenderer.invokethat self-throttles to the IPC round trip. The single-flight coalescer does not cover this: each IPC message is its own main-thread task and microtasks drain between tasks, so the in-flight entry is always empty when the next message lands.logGateRejectiontherefore throttles per WebContents — first 5 rejections in any 60s window are written, the rest counted, and the count reported once when the window rolls so a sustained flood stays visible at full magnitude. This bounds the write, never the verdict: every call still runs all three gates and still rejects, so no cachedfalseexists to strand a legitimate local user on a permanently-greyed menu (the failure mode the removal of negative caching exists to prevent).Positive-verdict expiry. A cached positive asserts three facts, and they are not all the same kind of fact. Gates 1 and 2 are properties of the page — the frame's origin and the sending window's gateway — so a navigation moves them and the
did-start-navigation/did-navigatelisteners clear the cache when it does. Gate 3 is a property of the machine: the primary port's LISTEN owner. It can change with nothing whatsoever happening to the sender. Our gateway exits and releases the socket, a foreign process or a hand-rolledssh -Lbinds that port, the page never navigates, no listener fires — and the cachedtruekeeps answering for the WebContents' remaining lifetime, skipping the one gate that can see a tunnel while the clipboard roles anddevtools-togglestay unlocked against a port this shell no longer owns. SPA route changes firedid-navigate-in-pageand are deliberately non-clearing, so there was no recovery short of a full top-frame navigation. A foreign listener can only take the port if our gateway released it first — nothing else can bind while we hold the socket — so the exposure is bounded by "our gateway exited", and a 5s expiry bounds it in time: the repeat calls one menu interaction produces still hit the cache (which is the whole reason it exists — a probe per click added hundreds of ms to a hot path), while a positive older than the window falls through to a fresh three-gate probe. Like the throttle above, this bounds the reuse of a verdict, never the verdict itself: afalseis still never cached. The expiry bounds what a positive may AUTHORIZE, not what it may PAINT: since8d4ba61b,app-menu:itemspaints a lapsed positive at once and re-probes in the background, whileapp-menu:executestill refuses unless a fresh probe proves a local owner, so the click stays the real gate (buluoray Blocking 1 oncb31d4f18a). See the F1 finding in GPT 5.6 Review onbd68985db(UPHOLD-FENCED, adjudicationflagged=0).Probes are coalesced, and a probe outcome is never permission. Gate 3 shells out per call with nothing cached beneath it, so concurrent callers on one WebContents await a single in-flight probe. That join is deliberately unconditional: a generation term there let a caller bump the generation with a navigation, decline to join, and spawn its own probe, handing a remote page the probe count. Generation equality belongs on the verdict, not on whether to share the work. Relatedly, the inconclusive mark records a WebContents and not the document that minted it, so the one reader left uses it only to withhold paint — which is why the soft read on
dev-mode-changedwas removed rather than generation-stamped.Port-owner classification.
classifyPortOwnergains"unidentified"— a holder netstat named whose command line could not be read — distinct from"unknown"(nothing known to hold the port) because two consumers need opposite answers: the app-menu gate wants it soft, and the adopt path needs it hard, since adopting posts this machine's.local_secretto a process it cannot name.WindowsTitlebarMenu.tsxrenders the refusal throughErrorNotice, anddocs/build/desktop-app.mdrecords the strict reading and its one accepted cost.Behavioural delta, stated rather than waived.
windows-menu-model.jsderivesgated— and thereforeenabled: falseand the footer — purely from the boolean verdict plus static set membership (const gated = senderIsLocal !== true && isLocalOnlyItem(...)), so nothing about why a verdict wasfalsereaches the renderer. Two appearances are new and both are captured below: the footer on any menu carrying a gated row, and the refusal notice a refused click renders (capture 8). One reachable state is new as well: a probe that cannot name the primary-port holder (unknown,unidentified, ornonewhile our gateway restarts) keeps the local user's LOCAL_ONLY rows painted enabled forINCONCLUSIVE_PAINT_GRACE_MS(30s past the 5s window, measured from the positive's mint time), but never authorizes a click. Past that grace the rows grey with the footer, so a probe that keeps failing is shown, not hidden. A proven foreign holder drops the positive at once, and a first call with no positive still fails closed. It cannot be photographed, since demonstrating it requires staging a probe failure inside that window.Backwards compatibility
Compatible for local senders. A user in a connection window whose dashboard has navigated to a remote gateway origin will see LOCAL_ONLY rows (Settings, Exit, Paste, Copy, Cut, Toggle DevTools, Keep on Top, Toggle Focus Mode, Reload, Force Reload, Zoom In/Out/Actual, the whole Connection submenu) greyed on the Windows titlebar menu — they must return to the main window to invoke those actions. The remote gateway sender was never intended to reach these actions in the first place; the fix closes an unintended path.
Physical keyboard shortcuts are unaffected, and a gated row carries no per-row marker about them. Greying already states the row is inert from this window; the footer states the part greying cannot:
Two sentences, and the second one is a claim about the keyboard that the gate now makes true by construction. Some chords do still act from a connection window: Electron's native dispatch routes an OS-registered accelerator (Reload
Ctrl+R, Zoom In/Out,F11, New Connection WindowCtrl+Alt+N, Refresh TokenCtrl+Shift+T) straight to the menu item, bypassing the app-menu IPC gate, and Chromium handlesCtrl+C/Ctrl+X/Ctrl+Vnatively in the focused renderer. Rows whose accelerator is display-only (Settings'Alt+,, an explicitregisterAccelerator: false) do not act.The earlier objection to that sentence was that it named a distinction the user could not resolve: a greyed Paste beside
Ctrl+Vand a greyed Settings besideAlt+,, told that some work, with no way to tell which. That objection is answered by removing the unresolvable case rather than by softening the copy.serializeMenuItemsnow blanks the accelerator of any gated row whose chord does not survive the gate, so every caption still visible on a greyed row is one that fires. In practice that suppresses exactly one: File ▸Settings…, whoseAlt+,isregisterAccelerator: falseand is routed by the renderer's own shortcut registry, which never receives the keystroke while focus sits in a remote page.The distinction is therefore applied rather than advertised. No per-row marker is drawn, no accelerator-registration field crosses the IPC boundary, and the footer's claim is scoped to the captions the user can actually see. The suppression is what makes the second sentence true rather than half-true.
The footer renders on any menu containing a gated row and on no other, so a user is always told why a row is grey, and it sits BELOW the mapped items so first-row geometry stays stable against the same menu in the main window. Its wording went through several rounds with UX Review over footer weight and over how much it should claim. The version here is the shortest one that is fully true of every gated row.
Tests
serializeMenuItems marks LOCAL_ONLY leaves disabled for a remote sender— remote paste/copy/cut greyed, sender-scoped Select All stays enabled, local sender restores everythingserializeMenuItems disables LOCAL_ONLY_ITEM_IDS on the View menu for remote senders— reload/zoom/devtools-toggle/keep-on-top all greyed (focus-scoped custom-click handlers resolve tofocusedDashboardWebContents(), so a remote sender in an unfocused connection window could otherwise reach the LOCAL dashboard)executeMenuItem should reject every LOCAL_ONLY role when sender is remote— paste, pasteandmatchstyle, copy, cut, quit, close, minimize, zoom, togglefullscreenexecuteMenuItem should reject items under connection-menu when sender is remote— whole-submenu fenceexecuteMenuItem should reject the keep-on-top item when sender is remote— per-item fence under an otherwise-safe submenuevery reachable menu leaf is classified in one direction— template-walk drift pin, both isMac branches, filtered byWINDOWS_TITLEBAR_MENU_IDSreachabilityLOCAL_ONLY sets pin the exact membership— set-shape pin catches silent wideningapp-menu:items forwards senderIsLocal=false so LOCAL_ONLY rows advertise as disabled— IPC boundary pinapp-menu:execute forwards senderIsLocal=false and logs the reject when the sender is remote— dispatch-side gate pindev-mode-changed is refused for a remote sender— a remote sender can no longer hide the local user's DevTools rowdev-mode-changed is refused when the port's holder cannot be named— loopsunknown/none/unidentifiedand assertssetDevModeis never called, which is the assertion for "a probe outcome is not permission" rather than one about a flag's valuedev-mode-changed refuses a remote caller that joins a pre-navigation probe— a mark minted by the previous document must not license the one that replaced itrepeated navigations must not multiply in-flight port-owner probes— drives the attacker's own loop (navigate, call, five times) and asserts the in-flight probe count never leaves 1. Behavioural rather than source-shape, deliberately: the shape pins can assert all three of the coalescer's anchors are present and still pass while a condition defeats it, which is exactly what happenedassert.doesNotMatch, so no generation term can return to it; the behavioural pin above is the authority on the classa flooding remote sender cannot force one gate log write per call— 200 sequenced calls (one per event-loop turn, matching real IPC delivery) must produce a bounded write count, while all 200 still reachmenu.executewithsenderIsLocal=falseso the throttle provably covers the log and not the verdictthe gate log throttle is per WebContents, not global— a second window's first reject still lands after a flooding sender exhausted its own bursta sustained flood reports its suppressed volume when the throttle window rolls— window-rollover summary names the suppressed count, so the log understates nothinga positive verdict older than its window re-runs all three gates— the lapse must reach the port-ownership probe again, not be answered from the cachea lapsed positive whose port owner has changed resolves to not-local— the security property itself: a verdict minted while our gateway held:portmust flip once aforeignlistener owns it, with the reject logged so the flip is attributablea positive verdict inside its window is answered without re-probing— guards the other direction, so the expiry cannot silently become a netstat/PowerShell shell-out per menu clicka navigation still invalidates a positive verdict inside its window— the expiry is an additional bound on gate 3's mutable fact, never a substitute for the origin checksmenuItems accepts and forwards senderIsLocal into serializeMenuItems— source-scan pin for the=== truefail-closed ruleexecuteMenu accepts and forwards senderIsLocal into executeMenuItem— source-scan pin for the boundary threadingProof: not provable -- frontend test (prove.py runs Python only)
That is
prove.py's own verdict, not a waiver, so the equivalent was done by hand at headf9599bbd6f97. Re-introducing the generation term in the join condition reddens exactly 2 tests —repeated navigations must not multiply in-flight port-owner probesand the join-condition shape pin. Restoring the soft read ondev-mode-changedreddens 4, includingdev-mode-changed is refused when the port's holder cannot be namedanddev-mode-changed refuses a remote caller that joins a pre-navigation probe, so the strict read is load-bearing for the two round-N regression pins as well as the new one.The
serializeMenuItems does not silently pass a submenu off as a commandcase inwindows-titlebar-contract.test.jsis migrated to the new(topLevelItem, senderIsLocal)signature — the guarantee that case tests (a nested submenu must not serialize astype: "normal") is unchanged; only the input shape moved to reflectserializeMenuItemsnow taking the top-level menu item so the per-action gate can classify by top-level id.90/90 in the four
website/electron/test/suites this PR touches, measured after the rebase recorded below. No production code test-only regressions.Re-run on Windows 11 (build 26200, Electron 43, Node 24.21.0):
website/electron/test/windows-menu-model.test.jswebsite/src/test/WindowsTitlebarMenu.test.tsxwebsite/electron/test/windows-titlebar-contract.test.js+window-lifecycle.test.jswebsite/electron/test/ipc-registrar.test.jswebsite/electronsuiteThe two
ipc-registrarfailures are environmental, not behavioural:dashboard:open-file validates the path before handing it to the OSand… opens a valid file at its realpathboth callfs.symlinkSync, which raisesEPERMon Windows unless the shell is elevated or Developer Mode is on. Neither touchesapp-menu:*.Rebased onto current
main(523 commits). The branch was 523 commits behind when themerge conflictlabel appeared. The conflict was confined to locale catalogs: 11 files (en.jsonplus 10 translations) each carried the same single hunk, where upstream appendedmetrics_card_old_data/metrics_card_fetch_failedat the exact tail position this PR's twotitlebar_menu_*keys occupy. Resolved keep-both with upstream's keys first and this PR's appended after, editing only the conflict markers so no translated value was retyped and no catalog was re-sorted —fr.json's U+202F narrow no-break space is untouched. No code file conflicted.One absorbed commit is worth naming because it lands on this PR's own surface:
b63c548df"refactor(electron): split the lifecycle modules into runtime owners" restructureswindow-lifecycle.jsandgateway-supervisor.jsbehindruntime/facades. The move is verbatim with exports unchanged, so the gate's call seams held; the post-rebase suites are the evidence rather than the assertion. Diff-scoped run after the rebase: 86/86 across the fourwebsite/electron/test/suites, 30/30WindowsTitlebarMenu.test.tsx, 101/101 i18n including the strict CI-mode gate. The diff remains 24 files and contains no Python —git diff --name-only upstream/main...HEAD -- '*.py'returns nothing, so any Windows backend test failure in CI is upstream's own and not reachable from this change.Manual verification
Windows Electron end-to-end verification is now done. Run on Windows 11 Enterprise (build 26200), Electron 43.2.0, Node 24.21.0. The three recipe steps and the accelerator behaviour were first verified at
e38a611b3/f72a2cc98on a CPython 3.14.7 backend, and re-verified after each subsequent amend; all seven attached captures and every geometry number below were re-taken at5db5c793bon a CPython 3.13.4 backend provisioned through uv — none is carried over from an earlier round. Nothing in the gate depends on the interpreter version — it is recorded because gate 3's port-owner probe does (see the prerequisite below). The titlebar menu was driven over the Chrome DevTools Protocol so each assertion reads the liveapp-menu:itemspayload as well as the rendered DOM; captures below are real renderer screenshots, not mockups.All three recipe steps pass.
enabled: true, gated: falsefor every leaf. No footer rendered, no glyphs. Nothing greyed.Settings…/Exitgreyed;Cut/Copy/Pastegreyed (gated: true) whileUndo/Redo/Delete/Select Allstay enabled; all eight View rows greyed,focus-mode-toggleincluded; the whole Connection submenu greyed. Every caption on every greyed row renders plain — no keyboard glyph and no strike-through anywhere, asserted as zero<svg>nodes in the popup and zero spans whose computedtext-decoration-linecontainsline-through. Footer present on every menu with a gated row and on no other. Both windows held these opposite states simultaneously — the main window stayed fully live while the connection window was fenced.Settings…arrives withaccelerator: "", so no caption span renders at all.Alt+,isregisterAccelerator: false, the one chord in the menu that cannot fire from a remote-focused window, and blanking it is what makes the footer's second sentence true of every caption that remains.In-product remedy confirmed. Clicking a greyed row (
View ▸ Reloadfrom the connection window) does nothing: the row reportsdisabled, no navigation occurs, the popup stays open, no crash, no partial dispatch.Physical accelerator path — verified on Windows. With a connection window focused on a remote gateway origin, pressing
Ctrl+Rreloads that connection window's own WebContents (Electron's per-window default accelerator dispatch — the chord is alive, but it reloads what has focus, not the main window's local dashboard).Ctrl+=behaves application-global (both windows zoom). Chromium clipboard chords (Ctrl+C/Ctrl+X/Ctrl+V) act on the focused renderer's own selection through Chromium's clipboard path, not through the app-menu IPC gate — which is why Cut/Copy/Paste keep their captions even though Electron reports themregisterAccelerator: false. Reading that flag alone would blank three captions that demonstrably work, which is whyacceleratorStillFiresFromThisWindowspecial-cases the Chromium-native clipboard roles. The row-specific target depends on Electron's dispatch model and is documented above per-role.Second Windows run at
5db5c793b— latency, paint behaviour, accelerator dispatch, and the paint/probe commit. Run independently of the measurements above, on a from-source venv build with the shell spawning its own gateway. Where it overlaps Design Review Watch 2 it agrees with it, which is two independent runs rather than one restated.Probe cost (First Principles item 5, and the advisory on layering). The probe shells out twice. Timed through
child_process.execFilewith argv byte-identical towindows-port.js—netstat.exe -ano, thenpowershell.exe -NoLogo -NoProfile -NonInteractive -Command <Get-CimInstance script>— five consecutive runs against the live gateway's port holder:Hundreds of milliseconds, not tens, so the caching layers are earning their place. The cost is structural to shelling out rather than to the query: the PowerShell spawn is 523–585ms of each total against 68–154ms for netstat, i.e. process start plus CIM cmdlet load, which no cheaper filter would recover. Each run returned 203 bytes naming the port holder, so these are timings of a probe doing its real work, not of a failing call. One host, five samples — it answers "does this cost hundreds of ms on a real Windows box", not "what is the floor on fast hardware".
What that costs the user (the advisory on the empty paint).
openMenusets the item list to[]and awaitsapp-menu:items, so the popup frame paints before the rows do. Measured with aMutationObserverstamping both transitions against the click:So the cache stack is the difference between 103ms and a second of empty menu, which is a stronger justification than the probe figure alone. On an open that paints empty, ArrowDown does not move focus —
document.activeElementstayed onBODYwith zero rows mounted, confirming the advisory: there is no enabled button to land on yet.Accelerator dispatch from a connection window — the footer's second sentence. Driven with Win32
SendInputagainst the connection window's handle, with the remote page holding keyboard focus. CDP was deliberately not used for this: its Input domain delivers into the renderer and never reaches Electron's OS accelerator dispatch, so it would have produced a false negative and sent the footer back for a rewrite in 13 locales for no reason.Ctrl+RCtrl+0Ctrl+=F11Ctrl+Shift+WCtrl+Alt+NCtrl+VCtrl+Shift+TSeven of the eight confirmed.
Ctrl+Shift+Tis recorded as unverified rather than passing: a token refresh has no in-page observable and the Electron log carries no token line either way, so there was no signal to read. It is a custom click handler, and two other custom click handlers on the same path (Ctrl+R,Ctrl+Alt+N) demonstrably fire, so the mechanism is proven for its class — but that is inference, not measurement, and it is the one caption in the menu whose footer claim rests on it.The execute gate, with a control (the paint/probe commit's security half). The question the paint change raises is whether a row that LOOKS enabled can be clicked through. Tested at the IPC boundary rather than on the button, because
disabledis cosmetic and a hostile page would callexecuteAppMenuItemdirectly. From the remote-classified window,Settings…,Reload,Toggle Focus ModeandKeep on Topwere all refused with no effect. The control matters more than the refusals: the identicalReloaddispatch from the LOCAL window destroyed a sentinel variable planted in the page, proving the detector could see a dispatch at all. An earlier attempt used "did the URL change" as the signal and showed no change for the legitimate local call either — a refusal measured with a blind detector proves nothing, so that run was discarded rather than reported.The 35s boundary. With the gateway killed and the port left unbound,
app-menu:itemswas polled on the main window every 2.5s. The rows came back greyed at t+34.9s, against the 35sPOSITIVE_VERDICT_TTL_MS + INCONCLUSIVE_PAINT_GRACE_MSpredict. The boundary is anchored to the positive's mint time, not to the gateway's death, and a successful respawn re-mints and restarts it — which is why this state is measurable but not photographable (see capture 7).Prerequisite for anyone re-running this from source on Windows
A from-source venv build cannot pass gate 3 of
assertLocalDashboardas written, and the symptom looks exactly like the false-negative envelope below: every LOCAL_ONLY row greyed in the LOCAL main window. This is pre-existing behaviour inwindows-port.js, not something this PR introduces — it sits upstream of the four-set classification, in the probe this PR consumes. (Following the pre-PR per-channel gating, the same gate-3 verdict would have refusedapp-menu:itemsoutright and left an empty menu rather than a greyed one; that inference is from the code path, not from a run of the pre-PR build.)Cause:
windowsGatewayExecutablePathstrusts the gateway launcher plus<venv>\Scripts\python.exeand<venv>\python.exe, on the stated assumption that "a distlib console launcher delegates to the venv interpreter." On Windows it delegates to the base interpreter. A venv'sScripts\python.exeis a forwarder, not a copy — it hands off to the interpreter in the base install, soWin32_Process.ExecutablePathfor the process holding the port is the base path, outside the trusted set. Measured on three distributions, all identical:Scripts\python.exe…\pythoncore-3.14-64\python.exe…\uv\python\cpython-3.13-…\python.exevenv…\Programs\Python\Python312\python.exeFor reference the real interpreter on that host is 106 KB — the forwarder is the larger file.
Isolation proof: with the port held by the base interpreter every LOCAL_ONLY row was greyed in the main window; with a real interpreter placed at
<venv>\python.exeso the listener reported a trusted path, the same build at the same commit enabled every row and the full recipe ran. One variable changed, and it was not code.Two candidate remedies, neither in this PR:
pyvenv.cfg(home/executable). Smallest change; the file already sits inside the trusted tree and needs no new privilege.gateway-supervisoralready owns the gateway child it launched, so "is the listener my child or its descendant?" sidesteps path matching entirely.A packaged Windows install is unaffected: its gateway is a frozen
kirocrew.exeinbackend-distwith no forwarder, so the image path is the executable's own.Covered by tests (15 node + 28 vitest):
serializeMenuItemsclassification for local + remote senders across every LOCAL_ONLY leaf.executeMenuItemrefusal for every LOCAL_ONLY role, submenu id, and per-item id when the sender is remote.buildMenuTemplateoutput on both isMac branches, every reachable leaf classified in exactly one direction.menuItemsandexecuteMenuforwardsenderIsLocal.did-navigateis wired BEFORE the probe and the cache write is guarded by a generation counter.gated(not!enabled), so a natively-disabled row never claims a remedy that does not apply to it. One fence test asserts a gated row renders no per-row marker at all — no keyboard glyph, no struck caption — feeding it both accelerator shapes Electron can report, so a decoration returning for either fails rather than shipping.Failure envelope for the probe (
resolveSenderIsLocal→assertLocalDashboard). The probe composes three gates: (1) sender origin, (2) local gateway URL match, (3) primary-port-owner via netstat + PowerShell. A false NEGATIVE (probe says "not local" when it is) greys the LOCAL main window's menu. Consequences: (a) fails CLOSED — no security regression, remote senders still can't reach LOCAL_ONLY leaves; (b) the physical OS accelerator (Ctrl+R etc.) is unaffected because it bypasses this IPC. A false POSITIVE (probe says "local" when it's remote) is the security-relevant direction and is what the three-gate composition + generation-counter cache write is designed to prevent — the whole point of this PR.One correction to an earlier claim in this section, from the Windows run: a false negative does not always "recover automatically on the next
did-navigate." Cache invalidation only re-runs the probe; if the underlying cause is persistent — as the source-venv port-owner mismatch above is — the re-run reaches the same verdict. It was observed to survive SPA navigation, a full sign-in navigation, and repeated app restarts. Automatic recovery holds only for a transient probe failure.Verify recipe for a maintainer with a Windows box. From source, apply the gate-3 prerequisite above first, or run a packaged install. Then: (1) open the local dashboard and click the titlebar hamburger — every menu should be fully enabled; (2) start a second gateway on another port (
kirocrew gateway --port 6789with its ownKIROCREW_HOME), open Connection ▸ New Connection Window… and give it that port, then click the titlebar hamburger in the new window — LOCAL_ONLY rows greyed with every accelerator caption rendered plain, and the footer present below the items; (3) confirm Settings (File menu) is greyed with itsAlt+,caption shown plain — no per-row marker is drawn on any gated row, so the footer is the only explanation and must be present. If any of these three check-boxes fails, the PR should not merge.Design Review Watch 2 — physical accelerator behaviour verified. On Windows, pressing Ctrl+R in a connection window reloaded that connection window's OWN dashboard; the main window was untouched. Pressing Ctrl+= zoomed BOTH windows. Tested in both directions to tell a leak from a design: Ctrl+R from the main window reloaded only the main window, and Ctrl+0 from the main window reset both — so reload is per-window while zoom is application-global, symmetric from either window rather than a connection-window leak into the local dashboard. The footer's second sentence therefore honestly says some shortcuts still work, with the caveat that for the zoom rows the action is global in scope rather than scoped to the focused window. Not a privilege path: only a user at the keyboard can produce these chords, and a remote gateway page cannot synthesise OS-level input. Verified with Win32
SendInputagainst each window handle, because CDP's Input domain delivers into the renderer and never exercises Electron's OS menu accelerator dispatch.Popup geometry, re-measured at
5db5c793bwith the current footer. Gated popups are 265.46px wide for File, Edit and View and 303.63px for the Connection submenu, against 223.99px (File) and 232.15px (View) for the same menus fully enabled in the main window. The footer now wraps to 2 rendered lines, and its box is 38.98px tall atmax-width: 240px— two 15.13px line boxes plus 8px of padding and a 0.75px top border. Line count was taken fromRange.getClientRects()over the footer's own text rather than by dividing the box height by line-height, which over-counts to 3 because the box includes that padding. Against the previously published 4 lines / 69px, both halve; the popup width is unchanged for three of the four menus.UX Watch — first-row displacement resolved by repositioning, not by copy. The footer string went through three versions while this watch was open, each measured on Windows rather than estimated: 137 characters originally, 142 after the single-sentence rewrite, 157 once it was split back into two sentences. The rendered geometry was identical in all three — footer 69px over 4 lines at the time, gated popups 265px wide. At
max-width: 240pxand 11px type all three of those strings landed on the same 4 lines, so the extra 20 characters filled slack within those lines rather than spilling onto a fifth. The copy lever could not move the weight. The shipped string is shorter than all three and now renders on 2 lines / 38.98px, so the weight did eventually come down — by shortening the copy once the per-row markers were removed, not by the repositioning alone.Moving the footer below the mapped items did resolve it, and the fix is measured on both sides rather than asserted. The first menu row's offset from the popup's own top edge is now 5px in the connection window and 5px in the main window — identical, across File, Edit, View and Connection. With the footer above the items that offset was the footer's 69px plus its margins, so a gated menu's first row sat roughly 70px lower than the same menu in the main window; that was the reviewer's "pushing Settings… ~70px down" observation and it is now zero. The footer's own height is unchanged; it simply no longer sits between the popup edge and the first actionable row. Verified by reading
getBoundingClientRect()on the popup and its firstbuttonin both windows, plus afooterBelowItemsassertion comparing the footer's top against the first row's. Re-measured at5db5c793b: 4.75px in both windows, across File, Edit, View and Connection — still identical, so the repositioning holds under the current footer.Reviewer watch — "Exit reads as enabled next to a greyed Settings…" is a perceptual artifact, not a render mismatch.
quitis inLOCAL_ONLY_ROLESand the row renders gated exactly as the classification requires. Re-measured at5db5c793b, both windows on thedracula-darktheme so the colours are comparable across the pair. Computed style on both File-menu rows, connection window against main window as control:disabled:6789):6789):5476)Alt+,:5476)Within each window the two rows are indistinguishable in computed paint — same
disabled, same opacity, same label colour — and across windows the gated pair sits at half opacity against the enabled pair at full. Exit is greyed alongside Settings, and there is nothing to fix in code.The accelerator column is new, and it retires the watch's underlying cause rather than just re-confirming the verdict. The asymmetry that made this read as a bug was that Settings… carried a caption while Exit had nothing beside it, so the Settings row had lower average luminance. With the caption now suppressed on gated rows whose chord cannot fire, both gated rows carry no caption span at all: the two rows in the connection window are now symmetric in paint and in content. The only File-menu row anywhere with a caption is the enabled Settings… in the main window.
The perception is worth recording, because it was a reasonable read at the time. When the watch was raised, Settings… carried a dimmed caption to its right while Exit had no accelerator and therefore nothing beside it, so the Settings row had lower average luminance even though the two labels were painted identically — and "Exit" is four blocky glyphs against a longer thin-stroked string, which reads denser at the same opacity on a dark background. The
disabledattribute alone could not have settled it, since a row can be disabled in the DOM and still paint at full strength if thedisabled:opacity-50variant fails to apply; it does apply. That cause is now gone at the source: on a gated row whose chord cannot fire the caption is not drawn, so the luminance asymmetry between the two rows no longer exists.Captures 1 and 5 are the same File menu in the two windows, and both were taken at
5db5c793b, so the pair is commit-matched and the half-opacity difference is legible across it in a way it is not within either window alone. The contrast to read is caption present at full opacity (capture 1, main window) against caption absent at half opacity (capture 5, connection window). The conclusion still rests on the computed-style table above rather than on a pixel comparison, because a direct read ofdisabled, opacity and colour is the stronger evidence either way.First Principles item 7 —
CHROMIUM_NATIVE_CLIPBOARD_ROLESis deleted, and the measurement is kept for the record. The objection was that if Electron reports anything other thanfalsefor the clipboard roles, the genericitem.registerAccelerator !== falsealready yieldstrueand the whole set does nothing. Read directly offMenu.getApplicationMenu()in the main process on Windows, Electron 43.2.0:registerAcceleratorcutfalsefalsecopyfalsefalsepastefalsefalsepasteandmatchstyleA literal boolean
falsein all three reachable cases, so the generic predicate returnsfalse. The rest of the same menu is the contrast that makes Electron's reporting deliberate rather than incidental —undo,redo,deleteandselectallall reporttrue, sofalselands on exactly the three chords Chromium claims natively.While the per-row keyboard glyph existed, this special case was the only thing flipping those rows to
true, and removing the set would have regressed them. The glyph is gone, so the set changed nothing a user could see and the objection — correctly rebutted while the glyph existed — became right. TheacceleratorRegisteredfield is therefore deleted fromwindows-menu-model.jsand fromelectron-bridge.d.ts, and a test pins its absence so it cannot regrow quietly. The other two did not stay deleted, and the diff says so plainly:CHROMIUM_NATIVE_CLIPBOARD_ROLESis back under the same name andacceleratorIsRegisteredis back asacceleratorStillFiresFromThisWindow. Their duty is inverted — they no longer export a flag for the renderer to paint a marker from, they decide locally whether to blank a caption. Nothing crosses the IPC boundary and the renderer makes no per-row judgement. If the objection was the wire surface and the glyph, both are gone; if it was that clipboard-role knowledge exists anywhere, it does still exist, in the main process, because without it Electron'sregisterAccelerator: falseon cut/copy/paste would blank three captions that fire. The table above is retained because the measurement is still the record of what Electron reports on Windows, and a future reader proposing the field again will want it.pasteandmatchstyleis a separate matter and stays: it is classified inLOCAL_ONLY_ROLES, which is the enforcement set, not the deleted accelerator set.app-menu.jsnever emits it outside macOS, so on Windows that entry is unreachable today and defensive rather than dead — it becomes live if a Linux frameless titlebar menu ever plugs intoexecuteMenuItem, which this PR's Windows-only enforcement rationale already anticipates.Measured without modifying the tree: attached to the Electron main process over
--inspectand read the MenuItem objects directly, rather than adding a temporary log line toserializeMenuItems. No instrumentation was introduced and none needed reverting.Note on step 2: connection windows are always
http://localhost:<port>—window-lifecycle.jsbuildsconnectionBackendUrlfrom a port, because a remote gateway is reached through an SSH tunnel presented on loopback. The gate trips on gate 1, the sender's origin differing from this shell's ownbackendUrl, not on the origin being non-loopback. An earlier version of this recipe suggested pointing the window atremote.example.test:6124or "any non-loopback origin", which the flow does not accept.Screenshots / video
Real Windows Electron renderer captures from the run described above. The scenario for the connection-window captures: a second local gateway on port 6789, so the connection window's origin differs from the shell's own
backendUrlandassertLocalDashboardresolvessenderIsLocal = false, marking every LOCAL_ONLY rowenabled: false+gated: true.1. Local main window, File menu — the enabled control for capture 5.
Settings…andExitare both at full opacity (disabled: false,opacity: 1,pointer-events: auto),Alt+,is present and rendered plain, and no footer is drawn because no row is gated. Same menu, same commit (5db5c793b), different window: read alongside capture 5, where the same two rows sit at half opacity and theAlt+,caption is absent entirely rather than struck. Those are the only two differences between the pair, which is what makes it a clean control.2. Local main window, View menu — the control case. Every row enabled, no footer, no glyphs.
3. Connection window, View menu — all eight rows
gated: trueand greyed,focus-mode-toggleincluded (it joined the gated set from upstream during the rebase). Every accelerator caption renders plain: no keyboard glyph on any row and no strike-through anywhere, asserted as zero<svg>nodes inside the popup and zero spans whose computedtext-decoration-linecontainsline-through.Keep on Tophas no accelerator, so no caption span renders beside it. The footer sits below the mapped items, so the first row stays flush with the popup's top edge — 4.75px here and 4.75px in the main window (capture 2), which is the first-row displacement watch closed by measurement rather than by copy.4. Connection window, Edit menu — the MIXED state that pins
gatedagainst natively-disabled. Cut / Copy / Paste aregated: true(LOCAL_ONLY_ROLES) and greyed, and they KEEP theirCtrl+X/Ctrl+C/Ctrl+Vcaptions, rendered plain. Electron reports these role itemsregisterAccelerator: falsebecause Chromium handles the chords natively in the focused renderer, so reading that flag alone would blank three captions that demonstrably fire —acceleratorStillFiresFromThisWindowspecial-cases the Chromium-native clipboard roles for exactly that reason. Verified by keystroke, not by inference: with the remote page holding focus,Ctrl+Vpasted a known clipboard marker into the connection window's own composer. Undo / Redo / Delete / Select All stay enabled — sender-scoped roles, safe for a remote sender. The footer renders because at least one row is gated.5. Connection window, File menu — the suppression, and the control for capture 1.
Settings…is greyed and itsAlt+,caption is absent entirely: the payload carriesaccelerator: "", so no caption span renders.Alt+,is the one chord in the menu that cannot fire from here —registerAccelerator: falsemeans Electron displays it without binding it, and it is routed instead by the renderer's in-page shortcut registry, which never receives the keystroke while focus sits in a remote page. Blanking it is what makes the footer's second sentence true of every caption that remains, and it replaces the strike-through an earlier round used to say the same thing.Exitis greyed with no accelerator, so nothing renders beside it either. Read alongside capture 1, the same File menu in the main window, where both rows are at full opacity andAlt+,is present.6. Connection window, Connection submenu — the whole submenu
gated: truevia LOCAL_ONLY_MENU_IDS, because every entry reaches local state (config file, SSH auth, spawning windows). New Connection Window… (Ctrl+Alt+N) and Refresh Token (Ctrl+Shift+T) keep their captions, plain, because those accelerators are OS-registered and survive the gate; Rename Window… / Set Remote Host… / Open Config File have no accelerator so nothing renders beside them.Ctrl+Alt+Nwas confirmed by keystroke from the focused connection window — it opened the gateway-port prompt. The macOS-only "New Window" (Cmd+Shift+N) entry is absent becausebuildMenuTemplateonly emits it on macOS. This popup is the widest of the four at 303.63px, set by its longest row rather than by the footer.7. Local main window, View menu, gate 3 refusing — the greyed MAIN window UX Review asked for by name. All eight View rows are
gated: trueand greyed and the footer renders in the main window, which is the finding rather than the backdrop: the copy tells the user items are unavailable "here" while "here" is the main window. The string was written for a connection window, where the main window genuinely is the way out; in this state it names no cause and offers no next step. Reached by holding the primary port with a process outsidewindowsGatewayExecutablePaths' trusted set, so gate 3's probe proves a FOREIGN holder and revokes the earned positive at once. The connection-error banners behind the popup are unavoidable: a greyed main window requires its own gateway to be gone.8. The refusal notice, with the menu still open. A refused click on
File ▸ Settings…renders the notice naming the row that did not run —"Settings…" did not run. Use this command from your main Kiro Crew window.— while the popup stays open, so the overlap between the notice and the menu is visible.Settings…andExitare both greyed behind it and the footer sits below them, so all three new surfaces are in one frame.Reached with no source change. A gateway run from this branch serves the window, so the menu's first open mints a positive locality verdict; the port's LISTEN owner is then replaced by a foreign process; the next open paints the rows from that cached positive while the click itself re-resolves strictly and refuses. That is the designed sequence rather than a staged one — the refusal is answered back to the renderer, which refetches
app-menu:items, and the rows repaint greyed with the footer.Two honest notes on what else is visible.
Gateway offline — message will not sendappears in the composer because the stand-in holder is not a Kiro Crew gateway; it is a side effect of the same staged port owner, not the cause of the refusal, which comes from gate 3 classifying the holder as foreign on a real click. And the stand-in has to answer HTTP at all:createBackendProbepasses on any status below 500, and a holder that merely drops connections makes the liveness monitor navigate the top frame to the loading page — which firesdid-start-navigation, invalidates the cached positive, and removes the dashboard the menu lives on. The frame is cropped to the application window.Why this capture is not the grace-expiry path, and why no screenshot of that path exists. The same pixels are reachable in theory by letting the paint grace lapse —
POSITIVE_VERDICT_TTL_MS(5s) +INCONCLUSIVE_PAINT_GRACE_MS(30s) after the last minted positive, with the port UNBOUND so the probe returnsnoneand lands inINCONCLUSIVE_PORT_OWNERS. That state was measured but could not be photographed, for two independent reasons. First, in normal operation it never arrives: the shell's liveness recovery respawns the gateway, a fresh probe returnslocal, and the positive is re-minted, restarting the clock — observed directly, where the IPC reported all eight rows gated and the rendered popup one second later showed all eight enabled again. Second, when recovery cannot succeed, the shell replaces the dashboard with its "gateway failed to start" screen at roughly t+33s — before the 35s boundary — so no titlebar survives to open. Three attempts were made, including one that polled by opening the menu so detection and shutter were the same action. The boundary itself was verified separately by pollingapp-menu:itemsafter the gateway died, with the rows greying at t+34.9s against the 35s the two constants predict. So the grace is a restart cushion that demonstrably works; it is not a state a user lands in, and the foreign-holder route above is the realistic way to reach a greyed main window.The three HTML mockups previously in this section are superseded by the captures above and have been removed.
Related Issues
no linked issue: standalone pre-flight security hardening carved out of the design discussion around #10247.
Sibling sweep
The defect this round's last fix addressed was textual: several places asserted that the DevTools row starts hidden, and therefore that the gate stops a remote showing it.
eceb35e995(#24810) had flipped that row tovisible: true, so the row is always offered and the capability the gate actually protects is a remote hiding it. Every site of that claim:website/electron/ipc-registrar.js-- changed herewebsite/electron/test/ipc-registrar.sender-locality.test.js-- changed heredocs/build/desktop-app.md-- changed herewebsite/src/shell/platform/electronBridge.ts:24-- not affected -- its wording is explicitly about a desktop shell older than this dashboard, which does build the item hidden, so the sentence stays true and the file is outside this PR's diffwebsite/electron/test/app-menu.test.js:229-- not affected -- it asserts thedevtools-toggleitem exists without asserting itsvisiblevalue, which is why feat(settings): merge the Developer page into Settings > Developer #24810 could invalidate the premise with nothing going red; named as the mechanism rather than widened into this PRThis description carried the same claim in
## What changedand in a## Testsbullet; both are corrected above.Pattern harvest
Rule candidate: agents-md
Pattern: a runtime policy expressed as "membership in one of N sets" needs a template-walk drift pin as well as a set-shape pin. The set-shape pin catches changes to the sets themselves; a template-walk pin walks the source structure the sets classify and asserts every reachable leaf is in exactly one direction. Missing the template-walk half is how a new item added to
app-menu.jswould inherit remote-safe on execute without a classification decision (the exact gap Spock's TEST-01 documented against an earlier draft).Rule candidate: agents-md
Pattern: a UI affordance that makes a claim about a platform mechanism ("this shortcut still works") cannot be validated by reading the source that renders it — only by running it on the platform. The glyph condition here (
gated && accelerator && acceleratorRegistered) was correct in code and correctly documented, yet the mockups derived from it were wrong for the clipboard roles, becauseregisterAcceleratorfor a role-based item is decided by Electron at runtime rather than by the template that declares it. Source-derived mockups should be labelled as predictions and any claim they encode re-checked on first real run.Follow-ups
Two items called out by review lanes are out of scope for this PR and are tracked here for a follow-up change:
Ungated non-menu preload channels (First Principles Item 10, Design Review Watch 1). Six channels —
update:check,update:download,update:install,update:set-channel,update:set-auto-download,local-gateway:set— remain reachable by a remote sender withoutassertLocalDashboard.update:installin particular reproduces the exact quit-harm this PR fences on the menu path. The next change should extendassertLocalDashboard(or an equivalent origin+loopback+port-owner check) to those channels so the "attack surface is single" phrasing is true for the whole preload boundary, not the menu alone.Gate-3 false negative for from-source Windows venv builds (Design Review Watch 2).
windowsGatewayExecutablePathstrusts<venv>\Scripts\python.exeon the assumption it is the interpreter; on Windows it is a forwarder that delegates to the base interpreter, whose path is outside the trusted set. Two candidate remedies:pyvenv.cfg(home/executable).gateway-supervisorowns the gateway child, so "is the listener my child or its descendant?" sidesteps path matching entirely.Both are non-trivial changes to
windows-port.jsthat would benefit from being landed on their own so the fix has room for its own Windows verification.Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)windows-menu-model.jsandipc-registrar.jsexplain the load-bearing gate rationale