Skip to content

fix(desktop): preserve permissions for every live main window #79

Closed

Description

@trmosala

Description

Each main window replaces permission handlers on the shared Electron session with handlers capturing only that window's webContents ID. Creating a second window denies the first window's notification/clipboard permission requests; closing the second leaves the handler tied to the wrong owner.

Priority: medium. Reviewed CookieMonster CM-Split-v2 at dafdcd4171466050c984d524ca0d1a09d31f100e; links use the identical remote V2 source on Ubuntu 26.04.1 x64, Bun 1.4.2.

Steps to reproduce and evidence

Executed production allowRendererPermissions with two synthetic WebContents sharing one session. A notifications request from the first returned true before registering the second and false afterward. The production window factories call this helper for each window. This is a boundary test, not a live OS notification test.

Acceptance criteria and verification

  • Install session-wide handlers once and validate against the live registered main windows.
  • Preserve origin/frame validation and deny unrelated browser/worker contents.
  • Add first/second-window and closed-window tests, then verify notifications/clipboard in Electron.

Source and related work

packages/desktop/src/main/windows/security.ts, packages/desktop/src/main/windows/index.ts, packages/desktop/src/main/windows/early.ts.

Inherited code remains present after V2 refactoring.

Activity

  1. trmosala commented on Oct 21, 2026

    @trmosala
    OwnerAuthor

    Merged into CM-Split-v2 as 290d7d6353c0c7a4a356af780b5687f2dcfe5cfc through PR #96. Its tree exactly matches reviewed source 68ab9205709350385471eb2d383b3cff3c18e678.

    Implemented in PR #96, reviewed source 68ab9205709350385471eb2d383b3cff3c18e678.

    Session-wide permission handlers now consult the live main-window registry instead of capturing the most recently registered window. Origin/frame restrictions still deny unrelated contents. Real Electron 44.4.5 checks exercised notification/clipboard permission handling in both main windows and after the second window closed. Those local native checks used --no-sandbox; OS sandbox qualification is not claimed.

    Final verification is deferred at the user's explicit request to finish and close the implementation issues before one final test pass. This closure records implementation completion, not a claim that the final combined/platform checks have passed. Any failure in that pass will be recorded against the relevant issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions