Skip to content

fix(browser): let a local HTML page follow its own file:// links - #30611

Merged
Jinwoo-H merged 1 commit into
mainfrom
browser-file-relative-link
Oct 19, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
browser-file-relative-link

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​27 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​27
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9

ELI5

If you open a local HTML file in Orca's built-in browser, clicking a link to another local file (for example <a href="index.html">) did nothing. Chrome and Safari follow it. Now Orca does too.

What Changed

Before: on a file:// page in an Orca browser tab, clicking a relative or absolute link to another local file was silently cancelled. Typing a file:// address still worked.

After: a local page can follow its own links to other local files. A web page (http/https) still cannot navigate or redirect the tab to a local file.

Mechanism: the browser tab's will-navigate guard cancelled every file: URL. That event fires when the page navigates itself (a link click), not when Orca loads an address, which is why typed URLs worked and clicks didn't. The guard now lets a file: target through when the page currently shown in the tab is itself a file: page. All other navigations go through the existing check unchanged, and redirects to file: stay blocked.

Why

The block was added with the HTML-preview feature so a remote web page could never steer the tab onto the local disk. That rule was wider than its goal: it also caught local pages linking to each other, which is the normal way multi-page local docs work.

Alternatives considered:

  • Only allow links inside the opened file's folder. Narrower, but it would break links like ../other/page.html, which Chrome allows.
  • Serve local files over a local web server instead of file://. It would also fix root-relative links and module scripts, but it is a much larger change for this bug.

Matching Chrome keeps the fix small. Chromium still treats each local file as its own separate origin, so a local page that opens another local file cannot read its contents.

The browser used by paired clients and the document-preview tab keep their stricter rules on purpose. A paired client must not be able to read the host's files.

Visual Proof

N/A for screenshots: the visible change is "a link click now navigates". I checked it in a hidden dev build by sending real mouse clicks over the devtools protocol and reading the tab's URL afterwards:

Case Before After
plan.html → relative link to index.html stays on plan.html goes to index.html
http://127.0.0.1 page → file:// link blocked still blocked

Testing

  • I manually tested these changes locally (macOS, hidden dev build with a throwaway profile, both before and after the fix)
  • Automated tests added/updated: browser-manager-guest-lifecycle.test.ts now checks that a file: link is blocked from a web page and allowed from a local page. The src/main/browser suite passes and pnpm tc:node is clean.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: web → file navigation and redirects stay blocked. Only file → file link clicks are newly allowed, the same as Chrome.
  • Cross-platform: URL-scheme check only, so no path handling or platform differences.
  • SSH / mobile / paired clients: unchanged. Those browsers use a separate guard that still blocks file:.
  • Performance: one string check per link click.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

The guest will-navigate guard cancelled every file: navigation, so clicking a
relative link on a file:// page did nothing. Allow file: -> file: when the
current page is itself a local file; web pages still cannot navigate or
redirect into the filesystem.
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: 362b0fad-b266-4a07-bcfb-ac546173a15f
📥 Commits

Reviewing files that changed from the base of the PR and between c68c84f and cfb5721.

📒 Files selected for processing: 2
  • src/main/browser/browser-manager-guest-lifecycle.test.ts
  • src/main/browser/browser-manager-guest-navigation-policy.ts

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

📝 Walkthrough

The guest navigation policy now allows navigation to a file: destination when the guest’s current URL also uses file:. Other file: destinations continue through navigationGuard. The tests cover navigation from HTTPS and file: pages. The policy registers and removes the new handler.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to cfb57

Local HTML pages can now follow links to other local files, and web pages remain blocked from navigating to file: URLs. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: allowing local HTML pages to follow their own file:// links.
Description check Passed The description is detailed and covers the user impact, implementation, rationale, security boundaries, testing, and cross-platform considerations. The linked issue field is blank, and the full lint, …
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
Full details: Description check

Explanation

The description is detailed and covers the user impact, implementation, rationale, security boundaries, testing, and cross-platform considerations. The linked issue field is blank, and the full lint, typecheck, test, and build checklist is not marked as passing, but the description is otherwise mostly complete.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@Jinwoo-H
Jinwoo-H merged commit 4aba685 into main Oct 19, 2026
32 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.

1 participant