Skip to content

fix(browser): name the requesting frame and the permission in denial notices - #15542

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/browser-permission-notice-accuracy
Aug 20, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/browser-permission-notice-accuracy

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​118 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​118
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​51

ELI5

When Orca refuses a website some capability, it shows a small notice saying who asked and for what. Both halves could be wrong: it named the wrong site when the request came from an embedded frame, and it often described the capability using an internal codename instead of words.

What Changed

Two independent defects in the same user-facing notice, both surfaced by the review of #15481 and deliberately left out of it.

1. The notice named the wrong site. setPermissionRequestHandler passed webContents.getURL() as the origin, which is the top-level document. A permission request from a cross-origin sub-frame was therefore attributed to the embedder — the user is told https://news.example.com asked for their location when the request actually came from an ad frame at https://widget.example.net.

Every PermissionRequest variant carries requestingUrl (MediaAccessPermissionRequest, FilesystemPermissionRequest and OpenExternalPermissionRequest all extend it), so the requesting frame is available at all three call sites. It now uses that, falling back to the top-level document only when absent.

2. The notice showed raw Chromium permission names. humanizePermission mapped exactly two permissions and returned the raw token for everything else, so users saw strings like top-level-storage-access, idle-detection and display-capture verbatim.

top-level-storage-access is the one that matters now: #15481 granted ordinary storage-access and deliberately left top-level-storage-access denied, which makes it the storage denial a user can still hit — and the only one they'd see, in its rawest possible form.

Added readable copy for the permissions users can actually reach. The default still returns the raw token, on purpose: inventing prose for a permission nobody has seen yet is worse than showing its real name.

Scope

This does not fix Google sign-in — that was #15216, fixed by #15221. It does not change which permissions are granted or denied; the verdicts are identical before and after. It only changes what the user is told when a denial happens.

Testing

Both halves verified red before the change; reverting both fixes fails both suites.

  • Sub-frame attribution: a request carrying requestingUrl: https://widget.example.net/embed from a guest whose top-level document is https://example.com/account now reports the widget origin. Red before — it reported the embedder.
  • Fallback: a request with no requestingUrl still reports the top-level document, rather than crashing or producing an empty origin.
  • Wording: top-level-storage-access renders in words, and the notice is asserted not to contain the raw token.
  • Unmapped permissions still name themselves — pins the deliberate fallback so a future refactor can't silently swallow an unknown permission into empty copy.

25/25 across both suites; typecheck clean.

…notices

Two defects in the same notice, both found by the review of #15481 and left out
of it deliberately.

The notice named the wrong site. setPermissionRequestHandler passed
webContents.getURL(), which is the top-level document, so a permission request
from a cross-origin sub-frame was attributed to the embedder. Every
PermissionRequest variant carries requestingUrl, so all three call sites now use
it and fall back to the top-level document only when it is absent.

The notice also showed raw Chromium permission names. humanizePermission mapped
two permissions and returned the raw token for the rest. That now matters more:
#15481 granted ordinary storage-access and left top-level-storage-access denied,
making it the storage denial a user can still hit - rendered as its raw token.

The default still returns the raw token. Inventing prose for a permission nobody
has seen is worse than showing its real name.

Does not change any permission verdict, and does not fix Google sign-in (#15221).
@coderabbitai

coderabbitai Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Permission-denial notifications now resolve the requesting URL, fall back to the top-level WebContents URL when needed, and report an empty URL for opaque or invalid URLs. Media flows capture this URL before asynchronous processing. Browser notices now provide descriptions for additional Chromium permissions and retain raw names for unmapped permissions. Tests cover URL fallback, opaque origins, navigation timing, queued denials, and permission text.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the changes and testing, but it omits the required linked issue, visual proof or N/A justification, and checklist sections. Add the required Linked Issue, Visual Proof, checklist, and other template sections; provide an issue number and explain why visual proof is N/A if applicable.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the primary change: improving requesting-frame and permission naming in denial notices.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/browser/browser-session-partition-policies.ts (1)

44-65: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Capture the fallback URL before the asynchronous media request.

Because requestSystemMediaAccess() resolves asynchronously, webContents.getURL() runs after the permission flow completes. If the page navigates during that interval, the notice uses the new URL instead of the URL that made the request. Capture requestingUrl || webContents.getURL() before starting the request and reuse that value in all denial paths.

Proposed fix
-    const requestingUrl = (details as Electron.PermissionRequest | undefined)?.requestingUrl
+    const rawUrl =
+      (details as Electron.PermissionRequest | undefined)?.requestingUrl || webContents.getURL()

...
-              rawUrl: requestingUrl || webContents.getURL()
+              rawUrl

...
-        rawUrl: requestingUrl || webContents.getURL()
+        rawUrl

...
-        rawUrl: requestingUrl || webContents.getURL()
+        rawUrl

Also applies to: 77-77

🧹 Nitpick comments (2)
src/renderer/src/components/browser-pane/navigate/browser-notices.ts (1)

18-21: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep changed comments concise.

  • src/renderer/src/components/browser-pane/navigate/browser-notices.ts#L18-L21: replace the four-line explanation with one concise note about raw-token fallback.
  • src/renderer/src/components/browser-pane/navigate/browser-notices.test.ts#L24-L25: shorten or remove the storage-permission rationale.
  • src/renderer/src/components/browser-pane/navigate/browser-notices.test.ts#L38-L39: shorten or remove the unknown-permission rationale.

As per coding guidelines, comments must be concise, non-obvious, and brief; prefer one line.

Source: Coding guidelines

src/renderer/src/components/browser-pane/navigate/browser-notices.test.ts (1)

26-48: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add coverage for the new permission mappings.

These tests cover top-level-storage-access and the raw-token fallback. They do not cover the new media, idle-detection, display-capture, window-management, keyboardLock, openExternal, fileSystem, HID, USB, serial, MIDI, or speaker-selection labels.

Add a table-driven test for the new mappings. This will catch malformed asked for to ... output and future label regressions.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f91613de-b291-4081-afd9-a5b9b0c4ad78

📥 Commits

Reviewing files that changed from the base of the PR and between fcdbcf8 and 70a4a10.

📒 Files selected for processing (4)
  • src/main/browser/browser-session-partition-policies.ts
  • src/main/browser/browser-session-registry.persistence.test.ts
  • src/renderer/src/components/browser-pane/navigate/browser-notices.test.ts
  • src/renderer/src/components/browser-pane/navigate/browser-notices.ts

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

Capture fallback URLs before asynchronous media permission handling and treat opaque requesters as unknown rather than blaming the top-level page. Clarify permission descriptions and cover origin normalization, navigation races, and mapped copy.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6578386e-2a95-43fb-b444-f2e5c6df5e11

📥 Commits

Reviewing files that changed from the base of the PR and between 70a4a10 and 22c32f0.

📒 Files selected for processing (5)
  • src/main/browser/browser-manager-downloads.test.ts
  • src/main/browser/browser-session-partition-policies.ts
  • src/main/browser/browser-session-registry.persistence.test.ts
  • src/renderer/src/components/browser-pane/navigate/browser-notices.test.ts
  • src/renderer/src/components/browser-pane/navigate/browser-notices.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Comment on lines +29 to +32
const requestingUrl = details?.requestingUrl
if (!requestingUrl) {
return webContents.getURL()
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

file="src/main/browser/browser-session-partition-policies.ts"
printf '%s\n' '--- candidate implementation ---'
cat -n "$file" | sed -n '1,120p'

printf '%s\n' '--- references and tests ---'
rg -n --glob '*.{ts,tsx,js,jsx}' \
  'browser-session-partition-policies|requestingUrl|resolve.*Url|getURL\(\)' \
  src test tests 2>/dev/null | head -300 || true

Repository: stablyai/orca

Length of output: 50371


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- focused references ---'
rg -n -C 4 \
  'resolvePermissionNoticeUrl|notifyPermissionDenied|setPermissionRequestHandler|requestingUrl' \
  src/main tests --glob '*.{ts,tsx,js,jsx}' \
  | head -250

printf '%s\n' '--- relevant test files ---'
git ls-files | rg 'browser-session-partition-policies(\.|/)|browser-session.*partition.*test|permission.*test' \
  | head -100

printf '%s\n' '--- URL behavior probe ---'
node - <<'JS'
for (const value of ['about:blank', 'data:text/html,hello', 'javascript:alert(1)', 'file:///tmp/a', 'https://example.test/a', '']) {
  try {
    const parsed = new URL(value)
    console.log(JSON.stringify({ value, origin: parsed.origin }))
  } catch (error) {
    console.log(JSON.stringify({ value, error: String(error) }))
  }
}
JS

Repository: stablyai/orca

Length of output: 23630


🏁 Script executed:

#!/bin/bash
set -eu

test_file="src/main/browser/browser-session-registry.persistence.test.ts"
printf '%s\n' '--- permission URL tests ---'
cat -n "$test_file" | sed -n '500,610p'

printf '%s\n' '--- policy implementation history/context ---'
git diff --stat
git status --short
rg -n -C 3 \
  'Opaque frame URLs|requestingUrl: .about:blank|requestingUrl: .data:|getURL:.*about:blank|rawUrl: .about:blank' \
  src/main --glob '*.{ts,tsx}' || true

printf '%s\n' '--- exact fallback semantics probe ---'
node - <<'JS'
function current(getURL, requestingUrl) {
  if (!requestingUrl) return getURL
  try { return new URL(requestingUrl).origin === 'null' ? '' : requestingUrl }
  catch { return '' }
}
function proposed(getURL, requestingUrl) {
  const candidateUrl = requestingUrl || getURL
  if (!candidateUrl) return ''
  try { return new URL(candidateUrl).origin === 'null' ? '' : candidateUrl }
  catch { return '' }
}
for (const [page, request] of [
  ['about:blank', undefined],
  ['data:text/html,hello', undefined],
  ['file:///tmp/a', undefined],
  ['', undefined],
  ['https://top.example/', undefined],
  ['https://top.example/', 'about:blank'],
  ['https://top.example/', 'not a URL']
]) {
  console.log(JSON.stringify({ page, request, current: current(page, request), proposed: proposed(page, request) }))
}
JS

Repository: stablyai/orca

Length of output: 7249


Validate the fallback URL.

When requestingUrl is empty, webContents.getURL() bypasses origin validation. An origin-null top-level URL such as about:blank is then reported as raw text instead of ''. Use one candidate for both paths and add a test for this case.

Source: MCP tools

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review complete — ready for Brennan's merge decision. I did not merge.

I pushed 22c32f07e8 with the review fixes:

  • captures the top-level fallback before async media permission handling, so navigation cannot change the reported requester;
  • uses details.requestingUrl for named frame origins, keeps the top-level compatibility fallback for missing/empty details, and reports opaque/malformed requesters as unknown instead of blaming the embedder or showing null;
  • distinguishes ordinary embedded storage access from top-level cookie access on behalf of an embedded site, fixes malformed/misleading permission copy, and covers all mapped labels plus the deliberate raw-token fallback;
  • leaves every permission verdict unchanged; the check handler remains policy-only and emits no notice.

Validation is clean: the same-model/high-effort second review returned CLEAN after its first opaque-origin finding was fixed; 81 focused tests passed locally, node/web typechecks passed, native and type-aware lint passed, max-lines and localization guards passed, and all required CI checks passed (E2E correctly skipped because no affected spec was detected). No manual Electron QA was run because this is deterministic attribution/string formatting with direct unit coverage.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron QA — permission denial notices

SHA tested: 22c32f07e8a28e18da991821896265200266ee28 (PR HEAD, includes reviewer follow-up 22c32f07e8)
Method: isolated pnpm/electron-vite dev instance (ORCA_DEV_INSTANCE_LABEL=qa-perm-notice-15542, dedicated ORCA_DEV_USER_DATA_PATH). Playwright CDP against the rendered Orca window. Two local origins on different ports (127.0.0.1:18765 parent, 127.0.0.1:18771 inner iframe).

Verified

1. Permission named in English, not a Chromium token

A top-level page at http://127.0.0.1:18765 requested camera access. The dismissible notice bar read:

http://127.0.0.1:18765 asked for camera or microphone access, and Orca denied it.

Not media.

case1-permission-named-in-words.png

2. Notice names the requesting frame, not the embedding page

Parent http://127.0.0.1:18765/parent.html embedded a cross-origin iframe from http://127.0.0.1:18771. The inner frame requested MIDI sysex. Address bar still showed the parent URL; the notice attributed the inner origin:

http://127.0.0.1:18771 asked for access to system-exclusive MIDI messages, and Orca denied it.

Not the parent origin, and not the raw midiSysex token. IPC event origin was http://127.0.0.1:18771.

case2-inner-frame-origin.png

Could not verify in the rendered UI

  • top-level-storage-access live denial. document.requestStorageAccessFor(...) is present and resolved as granted on this localhost fixture, so Orca never emitted a denial notice for that token. English copy for it (cookie access on behalf of an embedded site) is covered by unit tests, not by this screenshot.
  • Geolocation notice. navigator.geolocation.getCurrentPosition() was denied by Chromium (User denied Geolocation) but did not fire browser:permission-denied, so no notice bar appeared. Likely the session PermissionCheckHandler returning false short-circuits the request handler. Same for a live unknown / malformed requester (this page asked for …).
  • Did not separately screenshot ordinary storage-access vs top-level cookie access; storage-access is auto-granted by policy, so it does not produce a denial notice.

Did not merge. Did not change source.

@brennanb2025
brennanb2025 merged commit 2e895da into main Aug 20, 2026
46 checks passed
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 21, 2026
…notices (stablyai#15542)

* fix(browser): name the requesting frame and the permission in denial notices

Two defects in the same notice, both found by the review of stablyai#15481 and left out
of it deliberately.

The notice named the wrong site. setPermissionRequestHandler passed
webContents.getURL(), which is the top-level document, so a permission request
from a cross-origin sub-frame was attributed to the embedder. Every
PermissionRequest variant carries requestingUrl, so all three call sites now use
it and fall back to the top-level document only when it is absent.

The notice also showed raw Chromium permission names. humanizePermission mapped
two permissions and returned the raw token for the rest. That now matters more:
stablyai#15481 granted ordinary storage-access and left top-level-storage-access denied,
making it the storage denial a user can still hit - rendered as its raw token.

The default still returns the raw token. Inventing prose for a permission nobody
has seen is worse than showing its real name.

Does not change any permission verdict, and does not fix Google sign-in (stablyai#15221).

* fix(browser): keep permission denial attribution accurate

Capture fallback URLs before asynchronous media permission handling and treat opaque requesters as unknown rather than blaming the top-level page. Clarify permission descriptions and cover origin normalization, navigation races, and mapped copy.
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
…notices (stablyai#15542)

* fix(browser): name the requesting frame and the permission in denial notices

Two defects in the same notice, both found by the review of stablyai#15481 and left out
of it deliberately.

The notice named the wrong site. setPermissionRequestHandler passed
webContents.getURL(), which is the top-level document, so a permission request
from a cross-origin sub-frame was attributed to the embedder. Every
PermissionRequest variant carries requestingUrl, so all three call sites now use
it and fall back to the top-level document only when it is absent.

The notice also showed raw Chromium permission names. humanizePermission mapped
two permissions and returned the raw token for the rest. That now matters more:
stablyai#15481 granted ordinary storage-access and left top-level-storage-access denied,
making it the storage denial a user can still hit - rendered as its raw token.

The default still returns the raw token. Inventing prose for a permission nobody
has seen is worse than showing its real name.

Does not change any permission verdict, and does not fix Google sign-in (stablyai#15221).

* fix(browser): keep permission denial attribution accurate

Capture fallback URLs before asynchronous media permission handling and treat opaque requesters as unknown rather than blaming the top-level page. Clarify permission descriptions and cover origin normalization, navigation races, and mapped copy.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…notices (stablyai#15542)

* fix(browser): name the requesting frame and the permission in denial notices

Two defects in the same notice, both found by the review of stablyai#15481 and left out
of it deliberately.

The notice named the wrong site. setPermissionRequestHandler passed
webContents.getURL(), which is the top-level document, so a permission request
from a cross-origin sub-frame was attributed to the embedder. Every
PermissionRequest variant carries requestingUrl, so all three call sites now use
it and fall back to the top-level document only when it is absent.

The notice also showed raw Chromium permission names. humanizePermission mapped
two permissions and returned the raw token for the rest. That now matters more:
stablyai#15481 granted ordinary storage-access and left top-level-storage-access denied,
making it the storage denial a user can still hit - rendered as its raw token.

The default still returns the raw token. Inventing prose for a permission nobody
has seen is worse than showing its real name.

Does not change any permission verdict, and does not fix Google sign-in (stablyai#15221).

* fix(browser): keep permission denial attribution accurate

Capture fallback URLs before asynchronous media permission handling and treat opaque requesters as unknown rather than blaming the top-level page. Clarify permission descriptions and cover origin normalization, navigation races, and mapped copy.
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