You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
id(web): neutralize executable URL schemes in imported Markdown links #5745
Markdown converted for the ID web surface copies Comrak link URLs into HTML href attributes without rejecting executable schemes. In pkgs/id/src/web/markdown.rs around lines 2985-2995, imported or collaborative Markdown can contain a link such as open; when rendered and clicked in the same-origin application, the javascript URL runs in the user's browser context. The collab document path reaches this renderer via pkgs/id/src/web/collab.rs:141-153.
Existing renderer tests cover safe schemes but not javascript: (markdown.rs around lines 5808-5829 and 5879-5899). The /blob active-content mitigation in #908/#919 is related precedent but does not cover these editor links.
Required behavior
Only render URLs from an explicit safe set; neutralize executable or unknown schemes such as javascript:, data:, and vbscript:. Preserve safe http, https, mailto, and relative/internal links. Do not rely on browser sanitization.
Acceptance criteria
A regression test renders a javascript: link and proves it cannot produce an executable href.
Cases cover data:, vbscript:, protocol-relative, relative, http, https, and mailto, with a documented allowed-scheme oracle.
Collaborative Markdown rendering uses the same sanitizer as other Markdown entry points.
Existing safe-link behavior and formatting are unchanged.
Triage findings — issue #5745 is a live stored-XSS-class bug
Verified fresh against GitHub main c26e0585add3 (not the packet's stale line numbers alone):
Verbatim href copy, no scheme check.pkgs/id/src/web/markdown.rs, NodeValue::Link arm (line 2988 at that sha): let mut attrs = json!({"href": link.url}); — the Comrak URL goes straight into the ProseMirror link mark. A grep of the full 10,821-line file finds no scheme validation or sanitizer, and a repo code search for safe_scheme / allowed_schemes / sanitize_url / is_safe_url returns no hits anywhere.
Emit side is the same. At ~4972–4984 the save path builds <a href="..."> from linkHref with escape_attr_value only — attribute escaping stops quote-breakout, not a javascript: scheme.
Collab path reaches it.pkgs/id/src/web/collab.rs (~141–153): ContentMode::Markdown => markdown_to_prosemirror(&text) — collaborative Markdown uses the same unsanitized converter, exactly as the issue states.
Test gap is real. The renderer tests at ~5831–5901 assert https://, http://, and mailto: hrefs only; there is no javascript: / data: / vbscript: case in markdown.rs.
No competing work.gh pr list --search 5745 (all states) returns nothing; the issue carries no held / user/owned / do-not-merge / do-not-auto-edit labels.
Routing: fix scoped as a single allowed-scheme sanitizer (oracle: http, https, mailto, and scheme-less relative/internal references; protocol-relative decided and documented explicitly; every other scheme neutralized by dropping the href while keeping the link text), applied on both parse and emit paths so all Markdown entry points share it, with the acceptance-criteria test matrix from the issue body. Enqueued as a small_fix follow-up task — see the task 10157 completion for its task id.
Fresh verification (gh, 2026-11-05T19:13Z): issue #5745 is CLOSED and PR #6339 is MERGED at 2026-11-05T18:44:08Z (merge commit d492d6a). The work this task tracked is landed; the task's awaiting_ci checkpoint is superseded by the merge. Completing task 10643 as already_done with this evidence. The image-src half of the same converter gap is tracked separately as issue #6364 / fix task 10725.
Activity
developing-today commentedon Nov 5, 2026
CODE-1434
fix(id): neutralize executable URL schemes in imported Markdown links
dezren39 commentedon Nov 5, 2026
🤖 Agent note · done
c26e0585add36770e90d7b24480b9bb5b3564c5e.hidden_files/5745-fix-packet-10157.json).Triage findings — issue #5745 is a live stored-XSS-class bug
Verified fresh against GitHub main
c26e0585add3(not the packet's stale line numbers alone):pkgs/id/src/web/markdown.rs,NodeValue::Linkarm (line 2988 at that sha):let mut attrs = json!({"href": link.url});— the Comrak URL goes straight into the ProseMirror link mark. A grep of the full 10,821-line file finds no scheme validation or sanitizer, and a repo code search forsafe_scheme/allowed_schemes/sanitize_url/is_safe_urlreturns no hits anywhere.<a href="...">fromlinkHrefwithescape_attr_valueonly — attribute escaping stops quote-breakout, not ajavascript:scheme.pkgs/id/src/web/collab.rs(~141–153):ContentMode::Markdown => markdown_to_prosemirror(&text)— collaborative Markdown uses the same unsanitized converter, exactly as the issue states.https://,http://, andmailto:hrefs only; there is nojavascript:/data:/vbscript:case inmarkdown.rs.gh pr list --search 5745(all states) returns nothing; the issue carries noheld/user/owned/do-not-merge/do-not-auto-editlabels.Routing: fix scoped as a single allowed-scheme sanitizer (oracle:
http,https,mailto, and scheme-less relative/internal references; protocol-relative decided and documented explicitly; every other scheme neutralized by dropping the href while keeping the link text), applied on both parse and emit paths so all Markdown entry points share it, with the acceptance-criteria test matrix from the issue body. Enqueued as asmall_fixfollow-up task — see the task 10157 completion for its task id.developing-today commentedon Nov 5, 2026
🤖 Agent note · picked up
10 remaining items
dezren39 commentedon Nov 5, 2026
🤖 Agent note · parked
~/git/fleet/10643on branchqueue/10643-5745-markdown-link-schemes, PR fix(id/web): neutralize executable URL schemes in Markdown links (#5745) #6339. Their latest test run (/tmp/10643-test3.logon the laptop) passes all 5test_link_*tests, including the 3 new id(web): neutralize executable URL schemes in imported Markdown links #5745 tests, after fixing the TAB-destination case intest_link_executable_schemes_neutralized(Comrak forms no link for a TAB destination). I did not commit, push, or compete — parked task 10643 for 30 minutes for the owner session to push.test(id/web): fix tab-obfuscation case in #5745 link-scheme tests
fix(id/web): neutralize executable URL schemes in Markdown links (#5745…
developing-today commentedon Nov 5, 2026
agent-note:v1
state: done (already_done — verified merged/closed)
queue: repo-health-code-pilot
task: 10643 (small_fix; worker repo-worker-code; lane code-z)
by: repo-queue-worker-shift-z
at: 2026-11-05T19:14Z
Fresh verification (gh, 2026-11-05T19:13Z): issue #5745 is CLOSED and PR #6339 is MERGED at 2026-11-05T18:44:08Z (merge commit d492d6a). The work this task tracked is landed; the task's awaiting_ci checkpoint is superseded by the merge. Completing task 10643 as already_done with this evidence. The image-src half of the same converter gap is tracked separately as issue #6364 / fix task 10725.