Repository navigation
Conversation
… links open (#2117) DOMPurify's default URI allow-list drops the file: scheme, so an authored `[name](file:///abs/path)` link rendered as an anchor with no href. The click handler (setupExternalLinks) then saw an empty href and returned without posting open-file: no open, no toast, no error. Overlay markdown-cache.tsx and extend ALLOWED_URI_REGEXP with `file:`. javascript:, vbscript: and data: hrefs stay stripped. The extension's open-file handler still validates the path before opening anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
jacktrnr
marked this pull request as ready for review
November 23, 2026 21:56
Contributor
Author
|
Verified hands-on in the combined 0.4.1-beta test build ( |
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.
Closes #2117
Root cause (the
[name](file:///…)form)Click path: marked renders every link as
<a class="external-link" href=…>→sanitizeMarkdown(DOMPurify) →setupExternalLinksroutes afile://href toopen-fileover the iframe→parent bridge → the webview relay →chat_bridge.ts→ Preview, or a named toast.The chain breaks at the sanitizer. DOMPurify's default
ALLOWED_URI_REGEXPdoes not allow thefile:scheme, so the href was stripped. The anchor kept itsexternal-linkclass but had no href, andsetupExternalLinksreturned before posting anything. The result was total silence: no message reached the extension, so the #1845 named-outcome toasts never had a chance to fire. Authoredfile://links have never worked. The earlier fixes (#1839, #1845) covered only resolver-produced anchors, whose href is set after sanitization.Fix
packages/session-ui/src/components/markdown-cache.tsxto the overlay with one change:ALLOWED_URI_REGEXPis DOMPurify's default plusfile.javascript:,vbscript:anddata:hrefs stay stripped. The extension still validates the path (absolute, bounded, on disk or resolved through the posture) before opening anything.Tests
markdown-file-refs.test.tsgets a new "chat sanitizer keeps file:// links (BUG: file paths in chat output do nothing when clicked (inline-code pills and file:// links), v0.4.0 #2117)" case. happy-dom's DOMPurify tree walker never visits attributes duringsanitize(), so it would keep any href and could not discriminate. The test therefore checks the URI policy throughDOMPurify.isValidAttribute, which runs the same attribute checksanitizedoes in a real browser, under the config the chat sanitizer just applied.editable-diff-view.test.ts"selection highlight visibility" case. It also fails when that file runs alone and does not import either changed file.Not covered (inline-code pill form)
I traced the pill path statically:
markInlineCode→markFileLinks→ the app resolver →GET /amicode/resolve-file→file://anchor → the same bridge. I found no code break on a local loopback engine. The pill becomes a link only when the server resolves it. It stays a plain pill, by design ("never a dead anchor"), in these cases:browseAllowed→forbiddenunlessAMICO_VAULT_BROWSER=1);inlineCodeKindrejects it).Whichever applies, the click then does nothing. Telling these apart needs the reporter's posture, using the #1845 debug kit. The stale-bundle theory is not supported by the code:
release.ymlrunsbuild:appfresh for every tag, anddist/app/deploy.jsonrecordsbuilt_atand the commit for confirmation.🤖 Generated with Claude Code