Skip to content

fix(desktop): built-in browser denies geolocation on macOS instead of timing out - #26006

Open
juliusmarminge wants to merge 4 commits into
mainfrom
fix/issue-16589
Open

juliusmarminge wants to merge 4 commits into
mainfrom
fix/issue-16589

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

Problem

On macOS, a page in the desktop app's built-in browser sees navigator.permissions.query({ name: "geolocation" }) return granted, but getCurrentPosition() fails with code 3 Timeout expired after 30 seconds. BrowserSession grants geolocation on every platform. On macOS, Chromium then waits for CoreLocation app authorization. Electron has no API to request that authorization, and the app bundle declares no NSLocationUsageDescription, so the request can only time out.

Change

On darwin, BrowserSession drops geolocation from the preview's allowed permissions. Both the request handler and the check handler read that one derived set, so pages see denied and get an immediate PERMISSION_DENIED. The platform comes from the existing HostProcess.Platform reference. Other permissions, the openExternal confirmation, and Linux and Windows behaviour are unchanged.

Scope and approval

Fixes #16589

Triaged via the automated issue flow.

Verification

  • vp test run apps/desktop/src/preview/BrowserSession.test.ts: 8 passed. The new test denies geolocation on macOS, where Electron cannot request location authorization provides HostProcess.Platform as darwin. It fails on main with AssertionError: request handler should deny geolocation: expected true to be false. The existing grant test is pinned to linux, so it still covers the unchanged platforms.

  • vp run check:changed: format, lint, knip, typecheck, and tests all pass.

  • A runtime check of Chromium's response to each handler policy, with Electron 44.9.3 on Linux under Xvfb, loading https://example.com/ and running the issue's snippet (driver, transcript):

    Handler policy permissions.query getCurrentPosition
    Grant (main, all platforms) granted code 2 after 221 ms (Linux has no network location key)
    Deny (this PR, darwin) denied code 1 User denied Geolocation after 5 ms
  • No UI renders differently, so there are no screenshots.

  • cannot-verify macos: no macOS runtime was available. That macOS now reports denied and fails right away rather than after 30 seconds is inferred from the handler policy and the Linux check above.

Claude Opus 5.5 (claude-opus-5-5) in Claude Code via T3 Code, with review from GPT-6.1-Sol in Codex.

🤖 Generated with Claude Code

juliusmarminge and others added 3 commits October 27, 2026 15:51
…n macOS

Adds a failing test: with HostProcess.Platform set to darwin, both preview
permission handlers must deny geolocation. The existing grant test is pinned
to linux so it stays platform-independent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…timing out

Electron cannot request macOS CoreLocation app authorization, so a granted
geolocation request always hung to code 3 "Timeout expired". On darwin both
permission handlers now deny geolocation, so pages get an immediate
PERMISSION_DENIED. Other permissions and platforms are unchanged.

Fixes #16589

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 27, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — macOS browser sessions will deny geolocation immediately rather than report permission granted and time out. Human confirmation is needed for this change to the browser’s default permission behavior.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

BrowserSession denies geolocation permission requests and checks on macOS. Other platforms retain the existing permission set. Tests provide the host platform and verify the macOS permission results.

Changes: Preview permissions

Layer / File(s) Summary
Platform-specific permission policy
apps/desktop/src/preview/BrowserSession.ts, apps/desktop/src/preview/BrowserSession.test.ts
BrowserSession excludes geolocation from the allowed permissions on macOS, and both permission handlers use that platform-specific set. Tests verify that macOS denies geolocation and allows clipboard-sanitized-write and fullscreen.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested labels: bugfix

Suggested reviewers: maria-rcks

Merge Risk: Minimal · up to 8be13

The intended macOS behavior is to deny geolocation promptly while leaving other platforms unchanged. No actionable issue is established that should prevent merging after normal checks.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly describes the macOS geolocation permission change and uses a concise conventional-commit format.
Description check Passed The description covers the problem, change, scope and issue link, and focused verification. It also states that macOS runtime behavior was not directly tested.
Linked Issues check Passed Issue [#16589] allows clear denial when desktop geolocation is unavailable. BrowserSession.make removes geolocation from the macOS permission set. Both permission handlers use that set. The new te…
Out of Scope Changes check Passed All changes relate to [#16589]. The production change adjusts the preview browser's geolocation policy by platform. The tests verify the macOS denial and unchanged permissions. No unrelated behavior c…
Full details: Linked Issues check

Explanation

Issue [#16589] allows clear denial when desktop geolocation is unavailable. BrowserSession.make removes geolocation from the macOS permission set. Both permission handlers use that set. The new test verifies denial from both handlers on darwin and verifies that clipboard and fullscreen remain allowed. The issue's verified native-authorization follow-up describes work outside this PR; it does not make that implementation part of this PR's requirements.

Full details: Out of Scope Changes check

Explanation

All changes relate to [#16589]. The production change adjusts the preview browser's geolocation policy by platform. The tests verify the macOS denial and unchanged permissions. No unrelated behavior changes appear in the whole-PR diff.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d6ddfa5 and 8be13e3.

Files selected for processing: 2

  • apps/desktop/src/preview/BrowserSession.test.ts
  • apps/desktop/src/preview/BrowserSession.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

# Conflicts:
#	apps/desktop/src/preview/BrowserSession.test.ts
#	apps/desktop/src/preview/BrowserSession.ts
}).pipe(Effect.provide(layer)),
);

it.effect(

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.

This duplicates the existing permission-handler test. Could you fold the macOS case into that test, parameterizing the platform and expected geolocation result?

Posted via Macroscope — Test Signal

Copy link
Copy Markdown
Member Author

The automated pipeline stopped on this pull request and will not merge it:

the proof has no capture anyone can open:

  • Base permission: granted followed by code 3 after 30 seconds was not observed; the required macOS desktop runtime is unavailable.
  • Head permission: denied followed promptly by code 1 was not observed; the required macOS desktop runtime is unavailable.
  • No real-app recordings were captured or uploaded. Uploaded files document only the environment blocker.
  • Both boolean outcomes are false because neither behavior was observed, not because either commit failed a reproduction.

It stays open for a person to finish or close.

This branch has not been deployed

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

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Desktop browser reports geolocation as granted but location requests time out on macOS

1 participant