Skip to content

Fix Environment Browser Google sign-in and overlay blanking - #249

Merged
sambitcreate merged 4 commits into
mainfrom
cursor/browser-google-auth-overlays-942f
Sep 26, 2026
Merged

sambitcreate merged 4 commits into
mainfrom
cursor/browser-google-auth-overlays-942f

Conversation

@sambitcreate

@sambitcreate sambitcreate commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Problem

Environment Browser rejected Google sign-in with This browser or app may not be secure. The guest user-agent still included Aiden Agent/<version> because the product name contains a space, so the old Electron/aiden strip left a token Google treats as an embedded app.

Opening agent-step details (and other chat popovers) also blanked the live page. The native WebContentsView hid whenever any dialog/popover existed anywhere in the window, including hover cards that only cover the chat column.

Fix

  • Rebuild a Chromium-only guest user-agent and apply it on the profile session and each WebContentsView.
  • Align User-Agent / Client Hint request headers with that identity, without dropping preview-authorization headers. Full-version Client Hints are quoted; GREASE versions match.
  • Hide the native page only when a visible occluder actually intersects the browser slot (dialogs, overlays, menus, listboxes, popovers, CSS popovers, and data-browser-occluder surfaces such as the slash palette). Closed, aria-hidden, and inert ancestors are ignored.

Full-window dialog overlays still hide the guest so it cannot steal clicks from a modal.

Review

Grok 4.6 medium adversarial/blast-radius review approved. Residuals: Google can still reject tabs where CDP is attached; JS userAgentData may still mention Electron; 1px overlap blanks the whole slot. No mobile/settings/onboarding contract change.

Tests

  • Guest user-agent and Client Hint contracts
  • Overlay intersection geometry and hidden-occluder filter
  • Panel/service wiring and slash-palette occluder marker

npm run test:browser is the CI gate. Local npm ci hit registry ECONNRESET in this environment; focused UA/overlay contracts were executed against the reconstructed helpers.

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 25, 2026 03:04
Rebuild guest Chromium user-agent and Client Hints so Google no longer
rejects Aiden Agent/Electron as an insecure browser. Hide the native
page view only when floating chrome actually covers its slot, so agent
steps and other chat popovers no longer blank the open site.

Co-authored-by: Sambit Biswas <sambitcreate@users.noreply.github.com>
Quote sec-ch-ua-full-version, keep GREASE versions consistent, and ignore
closed, aria-hidden, or inert ancestor chrome when deciding whether the
native Environment Browser view must hide.

Co-authored-by: Sambit Biswas <sambitcreate@users.noreply.github.com>
@sambitcreate
sambitcreate marked this pull request as ready for review September 25, 2026 06:11
@very-hermes-bot

Copy link
Copy Markdown
Collaborator

Hermes Review Bot

Confidence: 5

Engine: agy/gemini-3.8-flash-high
Review mode: full
Head: c139c093e7984ada02c5d85d15f675e953d3926f
Generated: 2026-09-25T06:18:37+00:00
Reviews: 1

Summary

This change resolves two Environment Browser issues: Google account sign-in failures caused by Electron/app branding tokens in the guest identity, and unwanted native view blanking caused by window-wide overlay checks. Guest requests now use a reconstructed Chromium user agent alongside synchronized Client Hints (sec-ch-ua, sec-ch-ua-mobile, sec-ch-ua-platform, sec-ch-ua-full-version, and sec-ch-ua-full-version-list), while preserving internal preview authorization headers. In the renderer, native view presentation switches from a global dialog/popover existence check to 2D axis-aligned bounding box intersection against visible occluders (visibleBrowserNativeOccluders), keeping the browser view visible when chat popovers or step details appear outside its slot. Maintainers should double-check that third-party authentication flows requiring popup windows continue to inherit the rewritten session identity and do not trigger unexpected Google embedded-webview blocks when DevTools/CDP is active.

Confidence Score: 5/5

End-to-end tracing verified guest user agent extraction, Client Hint formatting, preview authorization preservation, and DOM occlusion intersection across both docked and floating frames.

📁 Important Files Changed
  • main/services/browser/core.ts: Reconstructs a clean Chromium-only user agent via browserGuestUserAgent and synchronizes Client Hint headers via applyBrowserGuestIdentityHeaders.
  • main/services/browser/service.ts: Applies the guest user agent on the browser session and new WebContentsView instances, and rewrites outgoing request headers in onBeforeSendHeaders.
  • renderer/lib/browser-ui-state.ts: Introduces BROWSER_NATIVE_OCCLUDER_SELECTOR, visibleBrowserNativeOccluders (ignoring closed, hidden, inert, or un-opened popovers), and browserNativeViewObstructed for AABB geometric intersection testing.
  • renderer/components/browser-panel.tsx: Replaces the window-wide overlay boolean with slot occlusion testing and expands the MutationObserver attribute filter to observe presence, popover, and style changes.
  • renderer/components/composer-slash-palette.tsx: Marks the composer slash menu with data-browser-occluder so floating browser frames overlapping the composer hide cleanly.
  • docs/environment-browser.md: Documents guest Chromium user agent behavior and slot-targeted overlay visibility rules.
  • main/services/browser/core.test.ts, renderer/lib/browser-ui-state.test.ts, renderer/components/browser-panel.test.tsx, renderer/components/composer.test.tsx: Test suites covering user agent normalization, Client Hint formatting, and geometry intersection edge cases.

Findings

No findings.

Sequence Diagram

sequenceDiagram
  autonumber
  actor User
  participant DOM as Renderer DOM
  participant Panel as BrowserPanel (renderer/components/browser-panel.tsx)
  participant State as browser-ui-state (renderer/lib/browser-ui-state.ts)
  participant Main as BrowserService (main/services/browser/service.ts)
  participant View as WebContentsView

  Note over Panel,State: 1. Overlay Occlusion Flow
  User->>DOM: Opens step details / hover card in chat
  DOM-->>Panel: MutationObserver / ResizeObserver callback
  Panel->>State: visibleBrowserNativeOccluders(document)
  State-->>Panel: Active occluder bounding rects
  Panel->>State: browserNativeViewObstructed(hostBounds, occluderBounds)
  State-->>Panel: false (disjoint bounds)
  Note over Panel: Slot unobstructed; presentation state unchanged (no blanking)

  Note over Main,View: 2. Guest Identity & Sign-In Flow
  View->>Main: Outgoing request (e.g. accounts.google.com)
  Main->>Main: applyBrowserGuestIdentityHeaders(headers, guestUserAgent)
  Note over Main: Electron/Aiden tokens replaced; Client Hints synchronized
  Main-->>View: Dispatch request with Chromium identity
Loading
[]

Last reviewed commit: c139c093e798
Reviews (1) · Comment /hermes review to trigger a new review · /hermes review full for full re-review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

This PR still has two must-address issues: the guest identity remains inconsistent between renderer metadata and rewritten request headers, and the full-screen Radix dialog overlay can be ignored, leaving the native page above a modal.

Reviewed changes: I reviewed the two commits covering guest UA and Client Hint handling and native browser occluder presentation.

  • Guest browser identity Rebuilds a Chromium-looking UA, applies it to profile sessions and views, and rewrites request Client Hints while retaining preview authorization.
  • Occlusion-aware presentation Computes rectangle intersection for dialogs, menus, listboxes, popovers, CSS popovers, and explicitly marked slash-palette surfaces, with filters for closed, hidden, and inert nodes.
  • Contracts and docs Updates the Environment Browser documentation and adds UA/header, overlay geometry, service wiring, and slash-palette contract coverage.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna | 𝕏

Comment thread main/services/browser/core.ts Outdated
Comment thread renderer/lib/browser-ui-state.ts Outdated
…p modal overlays occluding

- Stop forging a "Google Chrome" brand, a hand-picked GREASE brand, and
  high-entropy hints. Electron sends no UA-CH headers for guests, while the
  renderer's navigator.userAgentData reports Chromium + GREASE only. Emit the
  default low-entropy trio derived from Chromium's own brand algorithm, only to
  potentially trustworthy URLs, and strip any other sec-ch-ua* headers.
- Add an Electron E2E check that compares navigator.userAgentData with the
  headers a guest document and subresource actually send.
- Radix hideOthers marks the modal overlay's portal aria-hidden with a
  data-aria-hidden marker; do not treat that isolation as visual hiding, so an
  open full-window dialog overlay still hides the native browser view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GAkZRgQzUoKWGpgupF3a4D

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes: I re-reviewed the incremental changes since the prior Pullfrog review, focusing on guest identity consistency and native browser occlusion by modal overlays.

  • Aligned guest identity Rebuilt the low-entropy Client Hint brand list from Chromium's GREASE sequence and added an Electron E2E comparison between renderer metadata and document/subresource headers, with hints limited to potentially trustworthy origins.
  • Preserved modal occlusion Kept Radix-isolated dialog overlays in occluder discovery and added coverage for a full-window overlay covering a right-docked browser.

Pullfrog  | View workflow run | Using GPT Luna | 𝕏

@sambitcreate
sambitcreate merged commit c516c68 into main Sep 26, 2026
3 checks passed
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.

3 participants