Skip to content

fix: avoid internal link from all places - #9660

Merged
vijayh-bruno merged 5 commits into
usebruno:mainfrom
sid-bruno:fix/rce-docs-renderer
Nov 3, 2026
Merged

vijayh-bruno merged 5 commits into
usebruno:mainfrom
sid-bruno:fix/rce-docs-renderer

Conversation

@sid-bruno

@sid-bruno sid-bruno commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Description

  • Avoid opening any markdown document links into the main window and instead force it to open externally.
  • Make it so the electron process validates what's being opened in the main browser and only allow the trusted ones.

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.
  • I've run the claude code review skill locally.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • Security
    • Links in Markdown descriptions and documentation now open in a new tab with protections against unsafe link schemes.
    • App navigation is restricted to trusted app pages; web links open externally, while unsupported URL schemes are blocked.
    • Renderer access to app communications is limited to trusted app frames.
    • Embedded and About windows have more restrictive access to system features.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 50a2dae and 64caacc.

Files ignored due to path filters: 1
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 16
  • packages/bruno-app/src/components/AiChatSidebar/utils.js
  • packages/bruno-app/src/components/RequestPane/QueryEditor/index.js
  • packages/bruno-app/src/components/RequestPane/QueryEditor/index.spec.js
  • packages/bruno-app/src/components/RequestPane/QueryEditor/onHasCompletion.js
  • packages/bruno-app/src/components/RequestPane/QueryEditor/onHasCompletion.spec.js
  • packages/bruno-app/src/utils/markdown/openLinksExternally.js
  • packages/bruno-app/src/utils/markdown/openLinksExternally.spec.js
  • packages/bruno-electron/src/app/menu-template.js
  • packages/bruno-electron/src/index.js
  • packages/bruno-electron/src/preload.js
  • packages/bruno-electron/src/utils/trusted-url.js
  • packages/bruno-electron/src/utils/trusted-url.spec.js
  • packages/bruno-graphql-docs/jest.config.js
  • packages/bruno-graphql-docs/package.json
  • packages/bruno-graphql-docs/src/components/DocExplorer/MarkdownContent.test.tsx
  • packages/bruno-graphql-docs/src/components/DocExplorer/MarkdownContent.tsx

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

Walkthrough

Markdown renderers now add external-link attributes. Electron now validates app URLs and IPC senders, restricts navigation and external URL schemes, and updates security options for windows and webviews.

Changes

Markdown Link Rendering

Layer / File(s) Summary
App Markdown renderer and integrations
packages/bruno-app/src/utils/markdown/openLinksExternally.js, packages/bruno-app/src/components/AiChatSidebar/utils.js, packages/bruno-app/src/components/RequestPane/QueryEditor/*
A shared MarkdownIt plugin adds target="_blank" and rel="noopener noreferrer" to links. The AI chat sidebar and QueryEditor descriptions register the plugin. Tests cover HTTPS links and javascript: links.
GraphQL docs Markdown renderer and tests
packages/bruno-graphql-docs/src/components/DocExplorer/MarkdownContent.tsx, packages/bruno-graphql-docs/src/components/DocExplorer/MarkdownContent.test.tsx, packages/bruno-graphql-docs/jest.config.js, packages/bruno-graphql-docs/package.json
The renderer adds link attributes and uses the prior renderer or a fallback. Jest configuration, scripts, development dependencies, and tests support the renderer and cover HTTPS, javascript:, and file: links.

Electron URL and IPC Trust

Layer / File(s) Summary
App URL validation and IPC sender checks
packages/bruno-electron/src/utils/trusted-url.js, packages/bruno-electron/src/utils/trusted-url.spec.js
Utilities resolve and compare app URLs, check IPC sender frames, and wrap IPC registrations. Tests cover accepted and rejected URLs, senders, and IPC calls.
Main-process navigation and window settings
packages/bruno-electron/src/index.js, packages/bruno-electron/src/preload.js, packages/bruno-electron/src/app/menu-template.js
The main process uses the app URL, restricts navigation and IPC, and configures webviews and windows. The preload restricts openExternal to HTTP, HTTPS, and mailto schemes.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Renderer
  participant ipcMain
  participant restrictIpcToAppFrames
  participant isTrustedSender
  participant RegisteredCallback
  Renderer->>ipcMain: Send or invoke IPC
  ipcMain->>restrictIpcToAppFrames: Dispatch wrapped listener
  restrictIpcToAppFrames->>isTrustedSender: Check sender frame and app URL
  isTrustedSender-->>restrictIpcToAppFrames: Return trust result
  restrictIpcToAppFrames->>RegisteredCallback: Forward trusted event
Loading
Merge Risk: Minimal · up to 64caa

External Markdown links are handled by the system browser rather than opening an Electron window. The change is mergeable after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix: avoid internal link from all places" is related to the main change. The PR makes Markdown links open externally in all renderers (AI chat sidebar, query editor completion hints, GraphQ…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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: Title check

Explanation

The title "fix: avoid internal link from all places" is related to the main change. The PR makes Markdown links open externally in all renderers (AI chat sidebar, query editor completion hints, GraphQL docs) and adds the trusted-URL checks in Electron. The title is short and specific enough, but it does not name the Electron hardening (context isolation, IPC restriction, scheme filtering), which is a large part of the changeset. The wording "internal link" is slightly vague, but the core intent is clear.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 15 files. (1 skipped: 1 unsupported.)

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • 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

Markdown links gain a careful frame,
Safe attributes now mark their name.
App URLs guide each window’s way,
IPC checks each frame’s relay.
Electron keeps the boundaries clear.

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

@sid-bruno
sid-bruno marked this pull request as ready for review October 30, 2026 14:39
@sid-bruno
sid-bruno requested a review from a team October 30, 2026 14:39
@vijayh-bruno

Copy link
Copy Markdown
Collaborator

can we add an e2e test that clicks a link and asserts that the main window URL remains unchanged?

@vijayh-bruno
vijayh-bruno merged commit 553ef5a into usebruno:main Nov 3, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants