Skip to content

fix: only allow plain tag names in as and is - #523

Merged
farnabaz merged 1 commit into
mainfrom
fix/as-tag-name
Nov 17, 2026
Merged

farnabaz merged 1 commit into
mainfrom
fix/as-tag-name

Conversation

@benjamincanac

Copy link
Copy Markdown
Collaborator

While testing the Nuxt UI fix for GHSA-x9jw-j844-v24h, these markdown props still reached components on 0.23.3: ::prose-field{as="script"}, as="object" data="javascript:…" and as="img src=x onerror=alert(1)", which Vue's server renderer writes straight into the opening tag. Nuxt UI 4.12.2 blocks them on its side, but any other component that renders as stays exposed.

This PR makes as and is follow the same rule MDCRenderer already applies to data.component: a plain tag or component name (/^[a-z][\w-]*$/i) that doesn't name a tag that runs code (script, style, iframe, object, embed, base, link, meta, …). tag keeps accepting any string since it's often a data prop. The new parser and render tests fail on main (the render one needs a rebuild to show it), and the full suite, lint and typecheck pass.

@pkg-pr-new

pkg-pr-new Bot commented Nov 16, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxtjs/mdc@523

commit: b886839

@farnabaz
farnabaz merged commit 3732260 into main Nov 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants