fix(desktop/ipc): allowlist URL scheme protocols in openURLScheme - #5056
Merged
Merged
Conversation
The 'integration.openURLScheme' IPC method invokes 'shell.openExternal' with a renderer-supplied string after only checking that it contains '://'. Electron's documentation explicitly warns that passing untrusted URLs to 'shell.openExternal' is unsafe: schemes such as 'file://', 'smb://', 'ms-msdt:', 'search-ms:', 'jar:', 'res:', 'javascript:', 'data:' and 'vbscript:' have well-known abuse chains (local file disclosure, NTLM credential theft over SMB on Windows, MSDT/Follina-style RCE, etc.). Because the renderer process can also reach this IPC via any XSS sink in untrusted RSS feed content, the previous validation was not sufficient. Replace the substring check with strict URL parsing plus an allowlist of protocols that match the integration use-cases documented in the UI (Obsidian, Bear, Drafts, Things, Notion, DEVONthink) plus generic http/https/mailto. All other protocols are rejected with a clear error. Adds vitest cases for representative dangerous schemes (verifying that 'shell.openExternal' is never invoked) and for every scheme shipped as a built-in example, so future regressions on either side are caught.
Contributor
Author
|
Appreciate the review — thanks for getting it merged. |
DIYgod
added a commit
that referenced
this pull request
Jul 31, 2026
* release(mobile): release v0.5.6 * docs(mobile): restore desktop release inputs * fix(desktop): use js-yaml ESM exports * fix(desktop): package jsdom runtime dependencies * fix(desktop): use js-yaml ESM exports for Windows metadata * build(deps): bump actions/setup-node from 6 to 7 (#5046) Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6 to 7. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v6...v7) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix(ssr): escape hydration data in inline scripts * fix(ssr): restore shared user profiles * fix: make Codex worktree setup portable * fix(mobile): restore dark mode text colors * fix(styles): avoid DaisyUI border token collision * fix(desktop): restore category chevron rotation * fix(subscription): recover past-due Stripe checkout * fix(desktop): dismiss share popover after actions * fix(mobile): handle RSSHub subscription limit errors * fix(desktop/ipc): allowlist URL scheme protocols in openURLScheme (#5056) The 'integration.openURLScheme' IPC method invokes 'shell.openExternal' with a renderer-supplied string after only checking that it contains '://'. Electron's documentation explicitly warns that passing untrusted URLs to 'shell.openExternal' is unsafe: schemes such as 'file://', 'smb://', 'ms-msdt:', 'search-ms:', 'jar:', 'res:', 'javascript:', 'data:' and 'vbscript:' have well-known abuse chains (local file disclosure, NTLM credential theft over SMB on Windows, MSDT/Follina-style RCE, etc.). Because the renderer process can also reach this IPC via any XSS sink in untrusted RSS feed content, the previous validation was not sufficient. Replace the substring check with strict URL parsing plus an allowlist of protocols that match the integration use-cases documented in the UI (Obsidian, Bear, Drafts, Things, Notion, DEVONthink) plus generic http/https/mailto. All other protocols are rejected with a clear error. Adds vitest cases for representative dangerous schemes (verifying that 'shell.openExternal' is never invoked) and for every scheme shipped as a built-in example, so future regressions on either side are caught. * chore(ci): format integration URL scheme test * fix(mobile): use product IDs for Apple IAP verification * docs(desktop): prepare release inputs * docs(mobile): prepare release metadata * release(desktop): release v1.12.0 * docs(desktop): restore mobile release inputs --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sebastion <sebastion@sebastion.dev>
DIYgod
added a commit
that referenced
this pull request
Jul 31, 2026
* release(desktop): release v1.11.0 * docs(desktop): restore mobile release inputs * fix(desktop): use js-yaml ESM exports * fix(desktop): use js-yaml ESM exports * fix(desktop): package jsdom runtime dependencies * fix(desktop): package jsdom runtime dependencies * fix(desktop): use js-yaml ESM exports for Windows metadata * build(deps): bump actions/setup-node from 6 to 7 (#5046) Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6 to 7. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v6...v7) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix(ssr): escape hydration data in inline scripts * fix(ssr): restore shared user profiles * fix: make Codex worktree setup portable * fix(mobile): restore dark mode text colors * fix(styles): avoid DaisyUI border token collision * fix(desktop): restore category chevron rotation * fix(subscription): recover past-due Stripe checkout * fix(desktop): dismiss share popover after actions * fix(mobile): handle RSSHub subscription limit errors * fix(desktop/ipc): allowlist URL scheme protocols in openURLScheme (#5056) The 'integration.openURLScheme' IPC method invokes 'shell.openExternal' with a renderer-supplied string after only checking that it contains '://'. Electron's documentation explicitly warns that passing untrusted URLs to 'shell.openExternal' is unsafe: schemes such as 'file://', 'smb://', 'ms-msdt:', 'search-ms:', 'jar:', 'res:', 'javascript:', 'data:' and 'vbscript:' have well-known abuse chains (local file disclosure, NTLM credential theft over SMB on Windows, MSDT/Follina-style RCE, etc.). Because the renderer process can also reach this IPC via any XSS sink in untrusted RSS feed content, the previous validation was not sufficient. Replace the substring check with strict URL parsing plus an allowlist of protocols that match the integration use-cases documented in the UI (Obsidian, Bear, Drafts, Things, Notion, DEVONthink) plus generic http/https/mailto. All other protocols are rejected with a clear error. Adds vitest cases for representative dangerous schemes (verifying that 'shell.openExternal' is never invoked) and for every scheme shipped as a built-in example, so future regressions on either side are caught. * chore(ci): format integration URL scheme test * fix(mobile): use product IDs for Apple IAP verification * docs(desktop): prepare release inputs * docs(mobile): prepare release metadata * release(mobile): release v0.5.7 * docs(mobile): restore desktop release inputs --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sebastion <sebastion@sebastion.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
integration.openURLSchemeIPC method in the desktop main process invokesshell.openExternalon a renderer-supplied string after only checking that the string contains"://". Electron's documentation explicitly warns that passing untrusted input toshell.openExternalis unsafe: schemes such asfile://,smb://,ms-msdt:,search-ms:,jar:,res:,javascript:,data:andvbscript:have well-documented abuse chains (local file disclosure, NTLM credential theft over SMB on Windows, MSDT/Follina-style RCE, etc.).This PR replaces the substring check with strict
URLparsing plus an allowlist of the schemes the integrations UI is actually intended to support (obsidian,bear,drafts,things,notion,x-devonthink) plus generichttp,https, andmailto. Any other protocol is rejected with a clear error before reachingshell.openExternal.PR Type
Vulnerability details
apps/desktop/layer/main/src/ipc/services/integration.tsIntegrationService.openURLScheme(invoked over IPC from the renderer atapps/desktop/layer/renderer/src/modules/integration/url-scheme-handler.ts:72)ipcServices.integration.openURLScheme(scheme)→ main →shell.openExternal(scheme). The only pre-existing check wasscheme.includes("://"), which permitsfile://,smb://,jar:http://…, etc.smb://attacker/shareleaks the user's NTLM hash to an attacker-controlled host on a single click;ms-msdt:andsearch-ms:have historical RCE chains;file:///…allows unwanted local resource access.Fix rationale
new URL(scheme)so we get a real, normalized protocol rather than a substring guess. Invalid inputs throw and are rejected.:from the protocol, then check membership against aSetallowlist. The allowlist covers exactly the schemes that ship as built-in examples in the integrations UI (url-scheme-handler.tsexamples: Obsidian, Bear, Drafts, Things, Notion, DEVONthink) plushttp/https/mailtofor the generic "open link" cases.Tests
Added vitest coverage in
apps/desktop/layer/main/src/ipc/services/integration.test.ts:"not-a-url") without invokingshell.openExternal.shell.openExternalis not called:file:///etc/passwd,FILE:///…(case),smb://…,jar:http://…!/,res://shell32.dll/1,ms-msdt:/id PCWDiagnostic,search-ms:query=…,javascript:,data:text/html,…,vbscript:.url-scheme-handler.tsplus generichttp/https/mailto, and asserts the exact string is forwarded toshell.openExternal.Run locally with:
Proof of concept
From a rendered feed item (or any renderer context that can execute JS — the primary concern here is a stored-XSS gadget in third-party feed content), the following call previously reached
shell.openExternalverbatim and, on Windows, would exfiltrate the user's NTLM hash toattacker.example:After this PR the same call throws
URL scheme "smb://" is not allowed. Allowed schemes: bear, drafts, http, https, mailto, notion, obsidian, things, x-devonthink.andshell.openExternalis never invoked. The vitest suite reproduces this deterministically without needing a Windows host — it asserts on the mock.Adversarial review
Before submitting, we tried to disprove this finding. The relevant questions were:
url-scheme-handler.tsbuildsfinalSchemefrom user-configured templates and passes it straight to the IPC. The only gate was the substring check inside the main process.shell.openExternal? No — the web build routes throughwindow.open, which honors the browser's own scheme policies. The vulnerable path only exists in the desktop (Electron) build, which the PR correctly targets.url-scheme-handler.ts; all are covered. Users adding custom URL-scheme integrations for other apps will need those schemes added to the allowlist, which is the intended behavior for a security boundary.Linked Issues
None — reporting directly via PR per
SECURITY.md(a security advisory could also be filed, but the fix diff is small and self-contained, so we're proposing it publicly here).Additional context
The fix is intentionally minimal: two files changed, ~117 lines including tests. No dependency changes, no changes to renderer code, no changes to the IPC contract (same method signature and return shape).