Skip to content
VibeSafeDaily

Auth

A markdown preview that injects unsanitized HTML runs a script in the viewer's browser

Cataloged November 27, 2026 · Cursor

Symptom

This applies when an app converts user-written markdown to HTML and injects that HTML. User-written here includes comments, posts, profile bios, chat messages, and AI chat output. If this project does not inject HTML that came from markdown, this card does not apply. Cursor is the platform tag because that is the editor this site's readers open to paste a fix into their own project. The React and Vue pages on this card describe the render path, not a bug in one generator, so the same unsanitized HTML runs in the viewer's browser in any AI-built app, regardless of which tool generated it. React's page "Common components" says dangerouslySetInnerHTML should be used with extreme caution, and that if the HTML inside isn't trusted, for example if it is based on user data, you risk introducing an XSS vulnerability. It says the code embedded in the HTML will run, and: "Only use dangerouslySetInnerHTML with trusted and sanitized data." Vue's built-in directives page says: "Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to XSS attacks. Only use v-html on trusted content and never on user-provided content." The marked README's warning says: "Marked does not sanitize the output HTML. Please use a sanitize library, like DOMPurify (recommended), sanitize-html or insane on the output HTML." The worst case on this card is an admin or owner view. GitHub Advisory GHSA-crj3-q72p-ggqm, CVE-2026-64670, is that case, and it is the package this card can check by version. Its summary is "@waline/client vulnerable to stored XSS through unsanitized comment edit previews". The record's published_at is 2026-11-25T15:26:23Z. Its nvd_published_at is 2026-11-11T05:19:51Z. This card does not quote an NVD page. The advisory is rated critical, with CVSS 3.1 score 9.3. The record's cvss_v3 vector_string is CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N. The record does not print a CVSS 4 vector. The npm package is @waline/client. The vulnerable range is <= 3.16.2. The record's first_patched_version is null. A read of the npm registry record for @waline/client on November 27, 2026 showed dist-tags.latest 3.16.2, and the time for 3.16.2 is 2026-11-03T01:22:56.236Z. That record has no 3.16.3. The 3.16.2 dependencies field lists marked at ^18.1.2 and does not list dompurify. The advisory says the client renders the comment editor's live preview with marked and no sanitizer, injected with v-html, and that the client bundles no DOMPurify. It prints this return from packages/client/src/utils/markdown.ts: "return marked.parse(parseEmoji(content, emojiMap)) as string;". It says that when a comment is edited, the editor is seeded with the raw body, orig. It says packages/server/src/controller/comment.js:41 sets comment.orig = comment.comment for any logged-in user before :55 runs DOMPurify, so orig is the pre-sanitization body. It says only administrators and the comment owner can edit, and that an administrator who clicks Edit renders that raw HTML in their own session. It says the preview uses v-show, not v-if, so the node is in the DOM and an img onerror fires without opening the preview tab. It says the server sanitizes the public display copy with markdown-it and DOMPurify, so nothing fires for ordinary readers and the comment shows as a broken image. It says the waline JWT is in same-origin localStorage, so the payload can read it, yielding full administrative account takeover. The suggested fix is to sanitize parseMarkdown's output with DOMPurify before returning it, and to wrap the return in DOMPurify.sanitize with FORBID_TAGS form, input, and style, and FORBID_ATTR autoplay and style. This card does not paste the advisory's proof of concept. This card does not say every markdown preview is this package.

Root cause

The marked README's warning says marked does not sanitize the output HTML, and to use a sanitize library, like DOMPurify (recommended), sanitize-html, or insane, on the output HTML. Injecting that string is what runs it. React's "Common components" page says dangerouslySetInnerHTML overrides the DOM node's innerHTML, and that if the HTML isn't trusted, for example if it is based on user data, you risk an XSS vulnerability. The same page says the code embedded in the HTML will run, and that a hacker could use this security hole to steal user information or to perform actions on their behalf. It says to only use dangerouslySetInnerHTML with trusted and sanitized data. Vue's built-in directives page says v-html updates the element's innerHTML, and that dynamically rendering arbitrary HTML can easily lead to XSS attacks. It says to only use v-html on trusted content and never on user-provided content. Sanitizing the copy that the public page shows does not sanitize a second place that still renders the stored raw body. GitHub Advisory GHSA-crj3-q72p-ggqm says the Waline editor is seeded with orig, and that orig is the body from before the server's DOMPurify pass. It says the public display copy is the sanitized one. It says the preview uses v-show, so the v-html node stays in the DOM, and an img onerror fires without the preview tab being opened. Vue's v-show section says v-show works by setting the display CSS property via inline styles. Vue's v-if section says that if the initial condition is falsy, the inner content won't be rendered at all. This card does not say v-show is a bug by itself. The advisory's point is that hiding the preview does not keep that HTML out of the DOM. The advisory says the waline JWT is in same-origin localStorage, so the payload can read it. MDN's localStorage page says the property lets script access a Storage object for the document's origin, and the example read is getItem. MDN's CSP guide says code from an XSS attack can access or modify content in local storage. MDN's Set-Cookie page says the HttpOnly attribute forbids JavaScript from accessing the cookie, for example through the Document.cookie property, and that this mitigates attacks against cross-site scripting. The same page says a cookie created with HttpOnly will still be sent with JavaScript-initiated requests, for example fetch. This card does not say HttpOnly stops that request. The advisory says the payload can read the JWT in localStorage. MDN's CSP guide says websites should sanitize input before including it in the page, and that a CSP which controls what resources a document can load is a defense in depth when sanitization fails. This card does not say a CSP replaces the sanitizer.

Before and after

The before line is the return GitHub Advisory GHSA-crj3-q72p-ggqm prints from packages/client/src/utils/markdown.ts. The advisory says that function renders markdown with marked and returns the HTML with no sanitizer. The after line is the advisory's suggested wrap, not a release. The advisory says to wrap the return in DOMPurify.sanitize with FORBID_TAGS form, input, and style, and FORBID_ATTR autoplay and style. The advisory prints an ellipsis as the first argument. This pair leaves that ellipsis. It does not invent the call around marked.parse. The record's first_patched_version is null. A read of the npm registry on November 27, 2026 showed @waline/client 3.16.2 as latest, with no 3.16.3. This pair is not an upgrade. The marked README says to sanitize the output HTML. DOMPurify's README shows DOMPurify.sanitize(dirty).

Before

return marked.parse(parseEmoji(content, emojiMap)) as string;

After

return DOMPurify.sanitize(..., { FORBID_TAGS: ['form','input','style'], FORBID_ATTR: ['autoplay','style'] });

Fix prompt

In this project only. Do not scan or test anyone else's app. Do not open a site you do not own. Do not print keys, tokens, passwords, or environment variable values. When you mention a variable or a storage key, print the name only. Do not send a request to a host this project does not run. Do not post a comment, bio, or message on a site you do not own. Do not add a script that reads localStorage, document.cookie, or a token. Do not send data to another origin.

1. This prompt applies if this project converts markdown to HTML and injects that HTML. The strings to look for are comments, posts, profile bios, chat messages, and AI chat output. Search this project's files for dangerouslySetInnerHTML, for v-html, and for a markdown parser whose result is inserted as HTML, including marked.parse. Give the file and the line. If this project does not inject HTML that came from one of those strings, say so and stop. The bug is that render path. It is not a bug in the tool that generated the app. The same path is the bug in any AI-built app, regardless of which tool generated it.

2. React's page "Common components" says dangerouslySetInnerHTML should be used with extreme caution, and that if the HTML isn't trusted, for example if it is based on user data, you risk an XSS vulnerability. It says: "Only use dangerouslySetInnerHTML with trusted and sanitized data." Vue's built-in directives page says: "Only use v-html on trusted content and never on user-provided content." A comment, post, bio, chat message, or model reply is not the trusted source those pages describe. The React page does not name AI chat. This prompt includes it because that string is not HTML this project wrote as trusted markup. Do not leave a match from step 1 that injects one of those strings.

3. Sanitize the HTML after markdown is converted, on every path that injects it, including a live preview and an edit or admin view. The marked README's warning says: "Marked does not sanitize the output HTML. Please use a sanitize library, like DOMPurify (recommended), sanitize-html or insane on the output HTML." DOMPurify's README says DOMPurify sanitizes HTML and prevents XSS attacks, and it shows const clean = DOMPurify.sanitize(dirty). Pass the string the parser returned into DOMPurify.sanitize, and pass that result to dangerouslySetInnerHTML or v-html. Do not sanitize the markdown and then parse it. The marked warning says to sanitize the output HTML. DOMPurify's README says that if you first sanitize HTML and then modify it afterwards, you might easily void the effects of sanitization. Do not run another HTML transform on the sanitized string. If this project uses react-markdown and does not pass rehype-raw, leave that default. The react-markdown README says react-markdown typically escapes HTML, or ignores it with skipHtml, because raw HTML is dangerous. It says use of react-markdown is secure by default. It says the remarkPlugins, rehypePlugins, and components you use may be insecure, and: "To make sure the content is completely safe, even after what plugins do, use rehype-sanitize." If rehype-raw is already in the list, remove it, or add rehype-sanitize as that section describes. Do not add rehype-raw.

4. Do not render a stored raw body. GitHub Advisory GHSA-crj3-q72p-ggqm says the Waline editor is seeded with orig, the body from before the server's DOMPurify pass, while the public display copy is the sanitized one. If this project stores a raw field and a sanitized field, the preview, the edit view, and the admin view must inject the sanitized HTML, or they must sanitize again at that render. Search for a field named orig, original, raw, or body that is passed to dangerouslySetInnerHTML or v-html. Give the file and the line. Point that render at the sanitized value, or sanitize it in that render with the call from step 3. Do not delete the stored text.

5. If a login token is written to localStorage, give the file, the line, and the key name. Do not print the value. MDN's localStorage page shows getItem as the read. MDN's CSP guide says code from an XSS attack can access or modify content in local storage. MDN's Set-Cookie page says HttpOnly forbids JavaScript from accessing the cookie, for example through Document.cookie, and that this mitigates XSS. It also says an HttpOnly cookie is still sent with JavaScript-initiated requests such as fetch. This prompt does not say HttpOnly stops that request. If this project already has a server that sets the session cookie, set HttpOnly on that cookie and stop writing the token to localStorage. Do not invent a cookie name. Do not build a new login system in this step. If there is no server cookie, say so and leave the storage write, and tell me the key name.

6. Add a Content-Security-Policy only as a second layer, after step 3. MDN's CSP guide says websites should sanitize input before including it in the page, and that controlling resource loads is a defense in depth when sanitization fails. Do not skip step 3 because a header exists. If this project already sends Content-Security-Policy, give the file and the line, and do not remove a directive. If it does not, report that. Do not copy an example policy into the app. MDN's overview example is default-src 'self' and an img-src that names example.com. That example is not this project's hosts. Add a header only when you can name the directives from the script and image hosts this project already uses. If you cannot, do not add one. Show me the diff either way.

7. If this project depends on @waline/client, read the version from the lockfile, or run npm ls @waline/client in this project. The advisory does not print the command npm ls. GitHub Advisory GHSA-crj3-q72p-ggqm says the vulnerable range is <= 3.16.2 and first_patched_version is null. A read of the npm registry on November 27, 2026 showed dist-tags.latest 3.16.2, time 2026-11-03T01:22:56.236Z, and no 3.16.3. Do not invent a version to upgrade to. Do not tell me an upgrade is the fix until that advisory lists a first patched version. The advisory's suggested fix is to add dompurify and to wrap parseMarkdown's return in DOMPurify.sanitize with FORBID_TAGS form, input, and style, and FORBID_ATTR autoplay and style. If this project vendors that function, apply that wrap. If it only depends on the published package, say there is no patched release in those two sources, and tell me to check the advisory before treating an upgrade as the fix. Do not fork the package unless I ask.

8. Show me the diffs. Do not deploy. Do not print tokens. Do not edit unrelated files. Do not post <img src=x onerror=alert(1)> anywhere. That string is the self-check on the card, for a person to try on their own local or dev copy. It is not a test for you to send.

Paste this into the coding tool that has your own project open.

2-minute self-check

These steps are for an app you own. Do not run them against someone else's project.

  1. In a project you own, search for dangerouslySetInnerHTML, v-html, and a markdown parser whose HTML is injected, including marked.parse. React's "Common components" page says dangerouslySetInnerHTML with HTML that is not trusted, for example HTML based on user data, risks XSS, and to use it only with trusted and sanitized data. Vue's built-in directives page says never to use v-html on user-provided content. Check comments, posts, profile bios, chat messages, and AI chat output, and check the preview and the edit or admin view, not only the public page. Do not open a project you do not own.
  2. On a local or dev copy of an app you own, post a comment, bio, or chat message whose text is <img src=x onerror=alert(1)>. Open the public page, the preview, and the edit or admin view if you have one. If a dialog appears, the HTML ran, including when a preview tab was not the thing you opened. Vue's v-show section says v-show sets the display CSS property, and GitHub Advisory GHSA-crj3-q72p-ggqm says a v-show preview stays in the DOM so an img onerror fires without opening the preview. Do not post that string on a site you do not own. Do not change alert(1) into a read of localStorage, a cookie, or a request. Do not point this at a site you do not run.
  3. If a project you own depends on @waline/client, compare the version with 3.16.2. GitHub Advisory GHSA-crj3-q72p-ggqm says <= 3.16.2 is the vulnerable range and first_patched_version is null. A read of the npm registry on November 27, 2026 showed latest 3.16.2, published 2026-11-03T01:22:56.236Z, and no later version. There is no patched release in those two sources. Check the advisory before you treat an upgrade as the fix. In the browser, on your own local origin, look at the localStorage keys. MDN shows getItem as the read. Do not copy a value. If a session token is one of the keys, MDN's CSP guide says XSS code can access local storage, and MDN's Set-Cookie page says HttpOnly forbids JavaScript from accessing the cookie, for example through Document.cookie. Do not print the token.

Common questions

The public page shows a broken image and nothing runs. Is the admin view still the advisory's case?

Yes. GitHub Advisory GHSA-crj3-q72p-ggqm says the server sanitizes the public display copy with markdown-it and DOMPurify, so nothing fires for ordinary readers and the comment shows as a broken image. It says the editor is seeded with orig, the body from before that DOMPurify pass, and that an administrator who clicks Edit renders that raw HTML in their own session. It says only administrators and the comment owner can edit. It says the preview uses v-show, so the node is in the DOM and an img onerror fires without opening the preview tab. Vue's v-show section says v-show sets the display CSS property. Vue's v-if section says that if the initial condition is falsy, the inner content won't be rendered at all. The advisory's point is that a hidden v-show preview is still in the DOM.

This project uses react-markdown and does not pass rehype-raw. Does the README say raw HTML runs?

The react-markdown README says react-markdown typically escapes HTML, or ignores it with skipHtml, because raw HTML is dangerous. Appendix A shows rehype-raw as the plugin that renders HTML in the markdown. The security section says use of react-markdown is secure by default, and that the remarkPlugins, rehypePlugins, and components you use may be insecure. It says: "To make sure the content is completely safe, even after what plugins do, use rehype-sanitize." This card does not say a project that already passes rehype-raw is still on the default. If that plugin is in the list, the README's security section is the one that names rehype-sanitize.

@waline/client is on 3.16.2. What does the advisory say to install?

Nothing newer. The advisory record's vulnerable range is <= 3.16.2 and first_patched_version is null. A read of the npm registry record for @waline/client on November 27, 2026 showed dist-tags.latest 3.16.2, with the time 2026-11-03T01:22:56.236Z, and no 3.16.3. The suggested fix on the advisory is to sanitize parseMarkdown's output with DOMPurify before returning it, and to wrap that return in DOMPurify.sanitize with FORBID_TAGS form, input, and style, and FORBID_ATTR autoplay and style. Check the advisory for a first patched version before you treat an upgrade as the fix. The 3.16.2 dependencies field lists marked and does not list dompurify. The advisory says the client bundles no DOMPurify.

Sources

Same symptom

Same platform