Skip to content

Inline markdown renderer renders javascript: link hrefs #3858

Closed

Description

@mstomar125

Found while reviewing the markdown table renderer (PR #3856); the behaviour is pre-existing

The shared inline markdown renderer used for node display turns a link such as [click](javascript:alert(1)) into an anchor with the javascript: URL as its href. Raw HTML is escaped, but the href is not checked. app-shell.svelte (around lines 471 to 500) only intercepts clicks on http(s) and nodespace:// links, so a click on another scheme is left to the webview.

Why it matters

Node content is synced between members of a workspace (NodeSpace Sync), so another member's note can carry such a link.

Proposed change

Allow only a safe set of schemes (http, https, mailto, nodespace) when rendering a link href, and render anything else as plain text. Add tests for javascript:, data:, vbscript:, mixed case and whitespace/control-character variants.

Acceptance

  • A link with an unsafe scheme is never rendered as a clickable anchor.
  • Tests cover the schemes and variants above.

Activity

  1. added
    bug
    on Oct 20, 2026
  2. self-assigned this
    on Oct 21, 2026
  3. mstomar125 commented on Oct 21, 2026

    @mstomar125
    ContributorAuthor

    Claiming: fixing in a PR together with the deferred review nits from #3853.

  4. mstomar125 commented on Oct 22, 2026

    @mstomar125
    ContributorAuthor

    Fixed by #3863 (merged 2026-10-21): shared isSafeLinkHref allow-list (http, https, mailto, nodespace, scheme-less) applied in marked-config, chat-markdown, markdown-utils.processLinks and markdown-renderer.svelte; unsafe links render as label text. Tests cover javascript/data/vbscript/file, mixed case and control/whitespace/zero-width variants. Remaining defence-in-depth items are in #3864.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions