Skip to content

feat(browser): prompt before opening custom app protocol links - #13240

Closed
bbingz wants to merge 4 commits into
stablyai:mainfrom
bbingz:feat/12719-browser-external-app-protocol
Closed

bbingz wants to merge 4 commits into
stablyai:mainfrom
bbingz:feat/12719-browser-external-app-protocol

Conversation

@bbingz

@bbingz bbingz commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Review follow-up (6f57f659)

Deny devtools: in both URL classification and terminal-link matching. Browser guests now allow only one pending custom-scheme approval request per guest; repeated requests are blocked while it is pending, and the guard is released after settlement. Existing origin attribution and explicit user consent remain intact.

At this head, 27 focused tests across 4 files, all CLI/Node/Web non-composite TypeScript checks and changed-file lint/format passed. No prior assertions were removed. Electron effects are mocked; fullsuite/build, rendered Electron dialogs and real OS app handoffs were not repeated. Independent Cursor review passed for this exact commit.

Previously verified rebase

Summary

Embedded-browser links such as oktaverify:// now offer an explicit OS handoff instead of failing silently. Custom-scheme navigation and popups are blocked inside the guest, then require an Open/Cancel dialog showing the full URL. Cancel is the default; denied schemes cannot open an app.

The dialog attributes navigation and redirects to Electron's initiating frame. Known clicked-link frames supply their own origin; unavailable or destroyed sources display unknown rather than borrowing the top page's origin. Prompts are serialized, and main reclassifies the URL before opening it. Existing HTTP(S) and file-preview policies remain intact.

Partially addresses #12719. Remembered permissions and a Settings revocation list remain outside this change. Related: #13237 carries the terminal surface. Both currently include the shared classifier and opening helper independently; reconcile those shared files when either lands.

Validation

At 705f1a4a6a291efb803654793b6e7c75d3cbb94c:

  • Independent verification: 190 tests passed across 22 files, including initiating-iframe attribution, unknown origins, navigation, popups, classifier and confirmation behavior.
  • CLI, Node and Web TypeScript checks passed with --composite false; changed-file lint, formatting, diff whitespace and native-runtime preflight passed.
  • Independent Cursor security review passed for this exact commit with no medium-or-higher findings.

Full repository tests, packaged builds and a manual Okta Verify/OS-handler flow were not run. Unit tests mock the native confirmation dialog. No new RPC or stream opcode; the same guest policies serve SSH and folder workspaces.

AI disclosure

Cursor ported and reviewed this change; Codex independently checked the code and validation results before updating the PR.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: b2623696-08e9-430a-8cf4-191ffe760d9e

📥 Commits

Reviewing files that changed from the base of the PR and between 705f1a4a6a291efb803654793b6e7c75d3cbb94c and 6f57f659593ba11c84e228fbb91c2bb3a31ed9bf.

📒 Files selected for processing (5)
  • src/main/browser/browser-manager-guest-app-scheme.test.ts
  • src/main/browser/browser-manager-guest-popup-policy.ts
  • src/main/external-app-url-open.test.ts
  • src/shared/external-app-url.test.ts
  • src/shared/external-app-url.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/main/external-app-url-open.test.ts
  • src/main/browser/browser-manager-guest-app-scheme.test.ts
  • src/shared/external-app-url.ts
  • src/main/browser/browser-manager-guest-popup-policy.ts

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


📝 Walkthrough

Walkthrough

Adds shared classification for HTTP(S), custom app schemes, denied protocols, and invalid URLs. Adds approval-gated OS opening with explicit result statuses and serialized custom-scheme prompts. Adds requesting-origin extraction for guest frames and documents. Routes custom-scheme navigation and popup requests through approval handling while blocking unsafe in-guest navigation. Adds tests for classification, opening, origin extraction, navigation, popup handling, cancellation, denial, and concurrency.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 6f57f

Custom app-protocol links are blocked in the embedded browser and require confirmation before external opening, while denied protocols remain excluded. No concrete merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the implementation, security behavior, limitations, and validation results. However, it omits several required template sections, including ELI5, What Changed, Why, Visual Pro… Complete the required template sections. Add ELI5, What Changed, Why, Review, Agent skill upstream boundary, Notes, and Checklist content. Provide a linked issue in the required format. Attach before-and-after screenshots or a video for the…
✅ 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 and concisely describes the primary change: prompting users before opening custom app protocol links.
Full details: Description check

Explanation

The description explains the implementation, security behavior, limitations, and validation results. However, it omits several required template sections, including ELI5, What Changed, Why, Visual Proof, Review, Agent skill upstream boundary, Notes, and Checklist. It also does not provide the required visual evidence for this interaction change.

Resolution

Complete the required template sections. Add ELI5, What Changed, Why, Review, Agent skill upstream boundary, Notes, and Checklist content. Provide a linked issue in the required format. Attach before-and-after screenshots or a video for the confirmation-dialog behavior. Document manual testing status and platforms, and list the required lint, typecheck, test, and build results or state that CI will cover them. Retain the existing limitations about unrun full-suite, build, and real OS-handler testing if they remain applicable.


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: 2

🧹 Nitpick comments (1)
src/shared/external-app-url.test.ts (1)

29-42: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Add a vbscript: denial case.

The PR requires vbscript: denial, but this test does not cover it. Add a case for vbscript: so all required dangerous schemes have coverage.

Proposed test
     expect(classifyExternalAppUrl('data:text/html,hi')).toEqual({
       ok: false,
       reason: 'denied'
     })
+    expect(classifyExternalAppUrl('vbscript:msgbox("hi")')).toEqual({
+      ok: false,
+      reason: 'denied'
+    })
     expect(classifyExternalAppUrl('file:///etc/passwd')).toEqual({
       ok: false,
       reason: 'denied'
     })

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4dde8df0-a76a-4f09-b5f3-9dbc9001de1c

📥 Commits

Reviewing files that changed from the base of the PR and between 6da7b8e and 3e105b9fbdfab19335099173854d4bf590baceaf.

📒 Files selected for processing (5)
  • src/main/browser/browser-manager.ts
  • src/main/external-app-url-open.test.ts
  • src/main/external-app-url-open.ts
  • src/shared/external-app-url.test.ts
  • src/shared/external-app-url.ts

Comment thread src/main/browser/browser-manager.ts Resolved
Comment thread src/main/browser/browser-manager.ts Resolved
@bbingz

bbingz commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Review follow-up (batch 4)

Addressed confirmed medium findings:

  1. Unbounded concurrent prompts — openExternalAppUrlWithUserApproval now serializes custom-scheme confirm dialogs.
  2. browser-manager coverage — tests popup setWindowOpenHandler and will-navigate paths call the helper and emit opened-external / blocked popup events.

(Clicked-link silent deny was adversarially rejected: non-http schemes never use the private clicked-link frameName path.)

@bbingz

bbingz commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Relationship note — paired with #13237; they share a module.

Both add src/shared/external-app-url.ts (+ test) and fix the same silent failure on two surfaces: the embedded browser here (navigationGuard preventDefaults a same-tab custom-scheme navigation and emits nothing, so the renderer never learns), and the terminal in #13237 (handleOscLink returns false for non-http/file schemes).

Review them together; only one needs to carry the shared module and I'll move it to whichever lands first.

@nwparker nwparker removed the P1 label Aug 19, 2026
@bbingz
bbingz force-pushed the feat/12719-browser-external-app-protocol branch from ad1a2cd to 705f1a4 Compare September 8, 2026 21:14
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 046e22b1-a0b8-433c-a3a0-04b78e42c968

📥 Commits

Reviewing files that changed from the base of the PR and between 6b60c23 and 705f1a4a6a291efb803654793b6e7c75d3cbb94c.

📒 Files selected for processing (9)
  • src/main/browser/browser-manager-guest-app-scheme.test.ts
  • src/main/browser/browser-manager-guest-navigation-policy.ts
  • src/main/browser/browser-manager-guest-popup-policy.ts
  • src/main/browser/external-app-request-origin.test.ts
  • src/main/browser/external-app-request-origin.ts
  • src/main/external-app-url-open.test.ts
  • src/main/external-app-url-open.ts
  • src/shared/external-app-url.test.ts
  • src/shared/external-app-url.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/external-app-url-open.ts
  • src/main/external-app-url-open.test.ts

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

bbingz and others added 4 commits September 20, 2026 17:05
guest.getURL() credited the top page when an iframe initiated will-navigate.
Use Electron initiator / known iframe source, and unknown when that source is missing.

Co-authored-by: Cursor <[email protected]>
Browsing guests were classifying devtools:// as a custom app scheme and
prompting before navigation reject. Deny that scheme, and drop extra
per-guest prompts while one confirm is already open.

Co-authored-by: Cursor <[email protected]>
@bbingz
bbingz force-pushed the feat/12719-browser-external-app-protocol branch from 6f57f65 to 8986675 Compare September 20, 2026 10:50
@Finndersen

Copy link
Copy Markdown

Any updates on this? it's a big blocker for me..

@bbingz

bbingz commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #30490, which asks before a page opens another app.

@Finndersen custom-scheme links in the built-in browser now prompt and then open the app, on builds that include #30490. The terminal side is still open in #13237.

@bbingz bbingz closed this Oct 25, 2026
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.

5 participants