Skip to content

fix(desktop): let sites copy to the clipboard in the browser tab - #6696

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/browser-clipboard-write
Aug 14, 2026
Merged

fix(desktop): let sites copy to the clipboard in the browser tab#6696
waleedlatif1 merged 1 commit into
stagingfrom
fix/browser-clipboard-write

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • The browser tab's partition denied every site permission, which included clipboard-sanitized-write — the permission Chromium routes navigator.clipboard.writeText through. Copy buttons rejected with NotAllowedError and did nothing at all: no error shown, nothing copied.
  • Sites still using the legacy document.execCommand('copy') kept working, which is why only some sites looked broken and the cause wasn't obvious.
  • Allow that one permission. Reading the clipboard stays denied, along with media, geolocation, and notifications.

Granting it hands the page no reach it lacked: Chromium still requires the document to be focused and holding a transient user activation, and a sanitized write only places text the page already renders onto the clipboard. Clipboard read is the direction that would leak whatever the user last copied from anywhere else — that stays denied.

Type of Change

  • Bug fix

Testing

Measured against the app's exact partition configuration on a real Electron 43.1.1 runtime, with transient user activation (as a real copy-button click has):

Beforenavigator.clipboard.writeTextrejected: NotAllowedError Failed to execute 'writeText' on 'Clipboard': Write permission denied, and navigator.permissions.query({name:'clipboard-write'})denied.

AfterwriteTextresolved, permission query → granted, and the text actually landed on the system clipboard. Re-checked in the same run that the rest stay denied: clipboard.readText()NotAllowedError, Notification.requestPermission()denied, geolocation.getCurrentPositiondenied: code 1.

Unit test asserts the grant/deny split across media, geolocation, notifications, clipboard-read (denied) and clipboard-sanitized-write (granted); confirmed it fails when the fix is reverted. Type-check and lint pass.

Note: repo CI has been cancelling at Install dependencies on every branch including staging for several hours, so the CI signal here is unrelated to this change.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

The agent partition denied every site permission, which included clipboard-sanitized-write — the permission Chromium routes navigator.clipboard.writeText through. Copy buttons rejected with NotAllowedError and did nothing at all: no error, no copied text. Sites still on document.execCommand('copy') kept working, which is why only some looked broken.

Granting it hands the page no reach it lacked. Chromium still requires the document to be focused and holding a transient user activation, and a sanitized write only places text the page already renders onto the clipboard. Reading stays denied, along with media, geolocation, and notifications.
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 14, 2026 7:38am

Request Review

@cursor

cursor Bot commented Aug 14, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Narrow permission exception for sanitized clipboard writes only; clipboard read and other permissions remain denied, with documented Chromium focus/activation constraints.

Overview
Fixes broken web copy buttons in the desktop browser tab by no longer blanket-denying every Electron site permission on the agent partition.

configureAgentPartition now default-denies permissions but grants clipboard-sanitized-write, which Chromium uses for navigator.clipboard.writeText. That permission had been denied with everything else, so many copy actions failed silently with NotAllowedError while legacy execCommand('copy') still worked on some sites. Clipboard read and other sensitive permissions (media, geolocation, notifications, clipboard-read) stay denied.

Unit tests assert the grant/deny split on both the permission request and check handlers.

Reviewed by Cursor Bugbot for commit 12e7939. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR updates the desktop agent-browser partition to permit sanitized clipboard writes while continuing to deny clipboard reads and all other site permissions.

  • Adds a narrowly scoped clipboard-sanitized-write allowlist used by both Electron permission handlers.
  • Expands the session test to verify the grant/deny split for write, read, media, geolocation, and notifications.

Confidence Score: 5/5

The PR appears safe to merge because it narrowly restores user-activated clipboard copying without enabling clipboard reads or other sensitive site permissions.

The production handlers consistently use the same single-entry allowlist, and the tests cover both permission-handler paths and the sensitive permissions that must remain denied.

Important Files Changed

Filename Overview
apps/desktop/src/main/browser-agent/session.ts Replaces blanket permission denial with an exact sanitized-write allowlist while retaining default denial for every other permission.
apps/desktop/src/main/browser-agent/session.test.ts Verifies both request and check handlers grant sanitized clipboard writes and reject representative sensitive permissions.

Reviews (1): Last reviewed commit: "fix(desktop): let sites copy to the clip..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit 0650eab into staging Aug 14, 2026
28 of 30 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/browser-clipboard-write branch August 14, 2026 16:56
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