Skip to content

fix: sanitize component props #543

Merged
harlan-zw merged 1 commit intomainfrom
fix/xss-sanitize-props
Mar 26, 2026
Merged

fix: sanitize component props #543
harlan-zw merged 1 commit intomainfrom
fix/xss-sanitize-props

Conversation

@harlan-zw
Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Resolves GHSA-mg36-wvcr-m75h

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

Query params not matching known OG image options (width, height, component, etc.) were forwarded as component props to the Nuxt island renderer. Vue's fallthrough attributes then rendered unknown props as HTML attributes on the root element, enabling injection of event handlers (onmouseover, onclick) and dangerous attributes (autofocus).

Adds sanitizeProps() which strips on* event handlers and dangerous HTML attributes (autofocus, contenteditable, tabindex, accesskey) from props before they reach the island renderer. Includes unit tests.

…r-m75h)

Query params not matching known OG image options were passed as component
props to the Nuxt island renderer. Vue's fallthrough attributes then
rendered them as HTML attributes on the root element, enabling injection
of event handlers like onmouseover.
@harlan-zw harlan-zw changed the title fix: sanitize component props to prevent reflected XSS fix: sanitize component props Mar 26, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 26, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nuxt-og-image@543

commit: 5724b38

@harlan-zw harlan-zw merged commit 3dcf8c1 into main Mar 26, 2026
10 checks passed
@harlan-zw harlan-zw deleted the fix/xss-sanitize-props branch March 26, 2026 14:43
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.

1 participant