Skip to content

Revert "Preview HTML files by default" (#31575): clicked HTML can read local files - #31770

Closed
brennanb2025 wants to merge 4 commits into
mainfrom
brennanb2025/revert-31575-html-preview-default
Closed

brennanb2025 wants to merge 4 commits into
mainfrom
brennanb2025/revert-31575-html-preview-default

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​213 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1654 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1441
Prod 36 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​477 $\color{#cf222e}{\Huge{\mathbf{−}}}$​856 $\color{#cf222e}{\Huge{\mathbf{−}}}$​379

Problem

Since #31575 ("Preview HTML files by default"), clicking an .html file in Explorer, Quick Open, file drops, and Source Control opens it as a live page in an ordinary browser tab at its file:// path, and its scripts run. In v1.4.237 those general file-opening routes showed source or the existing source/diff view instead. Terminal HTML links were already an exception: ordinary Cmd/Ctrl-click opened a live browser preview in v1.4.237 too.

That browser tab is not the locked-down document-preview session that remote previews use (no content policy, no outbound-request filter), and the app does not turn off Electron's extra file:// privileges. A file:// page can therefore read other local files with fetch and send them to any website. This was reproduced in Electron 43.7.8 with the guest settings Orca forces: a report.html read a sibling secret.env.

So a repo that contains a hostile HTML file can read local secrets (for example a .env next to it) the moment someone clicks the file to look at it.

The production release scan for v1.4.237..main flagged this, and the release counsel kept it as release-blocking.

What changes for users

General HTML file-opening routes return to source or the existing source/diff view, as in v1.4.237. Rendering remains available through the existing explicit preview action. Terminal Cmd/Ctrl-click on a local HTML link still opens a live file:// browser preview: that route is byte-for-byte identical to v1.4.237, and this exact revert deliberately preserves it.

Change

git revert 524fa0039b4 (#31575). It applies cleanly on current main; no later commit imports the removed files.

Follow-up

The underlying exposure (a local HTML preview runs with full file:// read access) also exists in v1.4.237's explicit preview and terminal-link HTML route. The real fix is to serve local HTML previews through a restricted protocol/session (or turn off the extra file privileges) and then bring back preview-by-default. That belongs to the #31575 owner.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 22, 2026 01:59
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 05c3b9ed-1350-4e1e-8c2d-dca4faa6ddf4
📥 Commits

Reviewing files that changed from the base of the PR and between 19bf1cd and 144e4a3.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 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: c365a2a5-1e15-4167-bc4d-3e66f7f0afbb
📥 Commits

Reviewing files that changed from the base of the PR and between 8c456c3 and 19bf1cd.

📒 Files selected for processing: 1
  • src/shared/files-runtime-capabilities.ts
💤 Files with no reviewable changes: 1
  • src/shared/files-runtime-capabilities.ts

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

📝 Walkthrough

The change replaces the shared workspace-file opener with direct file, HTML-preview, and diff-opening paths. HTML preview planning and terminal-link routing are updated, and local preview freshness tracking is removed. File Explorer, Quick Open, editor drops, tab-entry actions, and document source actions use updated openers. Source Control rows, notes, and status-bar actions route through diff-specific handlers. Related tests and end-to-end coverage are revised or removed.

Priority: ⬆️ High

Merge Risk: 🟡 Moderate · up to 19bf1

The general HTML-opening routes are being reverted, but terminal HTML links can still open live local pages. The remaining preview-route and Source Control concerns also warrant resolution or explicit acceptance before merge.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the security problem, user impact, scope, and follow-up work, but it does not follow the required template. It omits the required ELI5, What Changed, Why, Linked Issue, Visual… Update the description to use all required template sections. Add an actual linked issue under “Fixes #”, provide visual proof or state “N/A” with a reason, document manual and automated testing, complete the AI Disclosure section when appl…
Docstring Coverage Warning Docstring coverage is 27.12% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 59 functions across 50 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: reverting default HTML preview behavior because clicked HTML files can read local files.
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 explains the security problem, user impact, scope, and follow-up work, but it does not follow the required template. It omits the required ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, and Checklist sections or their required content.

Resolution

Update the description to use all required template sections. Add an actual linked issue under “Fixes #”, provide visual proof or state “N/A” with a reason, document manual and automated testing, complete the AI Disclosure section when applicable, address the Review and Notes sections, and complete the Checklist.

✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • 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.

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


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: af764108-311a-48d5-b3d7-552671ac1157
📥 Commits

Reviewing files that changed from the base of the PR and between 01456c1 and 8c456c3.

📒 Files selected for processing: 63
  • src/renderer/src/components/QuickOpen.mount-gating.test.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/browser-page-toolbar.tsx
  • src/renderer/src/components/browser-pane/host-guest/browser-page-webview.ts
  • src/renderer/src/components/browser-pane/navigate/browser-file-editor-open.test.ts
  • src/renderer/src/components/browser-pane/navigate/browser-file-editor-open.ts
  • src/renderer/src/components/browser-pane/navigate/local-html-preview-freshness.test.ts
  • src/renderer/src/components/browser-pane/navigate/local-html-preview-freshness.ts
  • src/renderer/src/components/browser-pane/workspace-doc/doc-preview-document-actions.test.ts
  • src/renderer/src/components/browser-pane/workspace-doc/doc-preview-document-actions.ts
  • src/renderer/src/components/editor/editor-dropped-file-open.escaping-link.test.ts
  • src/renderer/src/components/editor/editor-dropped-file-open.ts
  • src/renderer/src/components/editor/use-editor-group-file-drop-owner.remote.test.tsx
  • src/renderer/src/components/editor/use-editor-group-file-drop-owner.test.tsx
  • src/renderer/src/components/quick-open-file-navigation.test.ts
  • src/renderer/src/components/quick-open-file-navigation.ts
  • src/renderer/src/components/right-sidebar/SourceControl.preview-open.test.tsx
  • src/renderer/src/components/right-sidebar/file-explorer-drag-scroll-marker.test.tsx
  • src/renderer/src/components/right-sidebar/file-explorer-instant-dir-toggle.test.ts
  • src/renderer/src/components/right-sidebar/source-control-branch-section-heading.test.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/active-open-file-keys.ts
  • src/renderer/src/components/right-sidebar/source-control/listing/branch-entry-row.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/branch-section.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.test.ts
  • src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.ts
  • src/renderer/src/components/right-sidebar/source-control/listing/section-action-buttons.test.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/section-file-list.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/uncommitted-sections.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/use-file-listing.ts
  • src/renderer/src/components/right-sidebar/source-control/listing/use-row-opening.ts
  • src/renderer/src/components/right-sidebar/source-control/listing/use-selection.ts
  • src/renderer/src/components/right-sidebar/source-control/notes/use-note-opening.ts
  • src/renderer/src/components/right-sidebar/source-control/panel/panel-content.tsx
  • src/renderer/src/components/right-sidebar/source-control/panel/use-panel-model.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-tree-pane-state.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerHandlers.test.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerHandlers.ts
  • src/renderer/src/components/status-bar/workspace-space-open-change.test.ts
  • src/renderer/src/components/status-bar/workspace-space-open-change.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-absolute-file.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-action.test.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-action.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-local-path.test.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-preview.test.ts
  • src/renderer/src/components/terminal-pane/terminal-file-link-editor-open.ts
  • src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts
  • src/renderer/src/components/terminal-pane/terminal-link-file-open-routing.test.ts
  • src/renderer/src/components/terminal-pane/terminal-link-handlers-test-fixtures.ts
  • src/renderer/src/components/terminal-pane/terminal-link-handlers-test-harness.ts
  • src/renderer/src/components/terminal-pane/terminal-link-handlers.ts
  • src/renderer/src/components/terminal-pane/terminal-link-open-beside-source.test.ts
  • src/renderer/src/components/terminal-pane/terminal-link-remote-runtime-ssh-open.test.ts
  • src/renderer/src/lib/file-preview-tab.ts
  • src/renderer/src/lib/file-preview.test.ts
  • src/renderer/src/lib/file-preview.ts
  • src/renderer/src/lib/open-html-file-preview.test.ts
  • src/renderer/src/lib/open-html-file-preview.ts
  • src/renderer/src/lib/workspace-file-open.test.ts
  • src/renderer/src/lib/workspace-file-open.ts
  • src/renderer/src/lib/workspace-file-preview-page.ts
  • src/shared/files-runtime-capabilities.ts
  • src/shared/html-file-url.ts
  • tests/e2e/html-file-url-opening.spec.ts
  • tests/e2e/html-source-control-preview.spec.ts
💤 Files with no reviewable changes: 13
  • src/renderer/src/components/right-sidebar/source-control/listing/branch-entry-row.tsx
  • src/renderer/src/lib/workspace-file-open.test.ts
  • src/renderer/src/lib/file-preview-tab.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-local-path.test.ts
  • src/renderer/src/lib/workspace-file-preview-page.ts
  • src/renderer/src/components/browser-pane/host-guest/browser-page-webview.ts
  • src/renderer/src/components/browser-pane/navigate/local-html-preview-freshness.test.ts
  • src/renderer/src/components/browser-pane/navigate/local-html-preview-freshness.ts
  • src/renderer/src/components/QuickOpen.mount-gating.test.tsx
  • src/renderer/src/lib/workspace-file-open.ts
  • src/renderer/src/components/right-sidebar/source-control/listing/active-open-file-keys.ts
  • src/shared/files-runtime-capabilities.ts
  • tests/e2e/html-source-control-preview.spec.ts

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

Comment thread src/renderer/src/lib/file-preview.ts Resolved
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing: Jinjing is fixing the P0 forward instead of reverting (tracked in STA-11670).

@brennanb2025
brennanb2025 deleted the brennanb2025/revert-31575-html-preview-default branch October 22, 2026 05:32
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