Skip to content

Render HTML and preformatted CVE descriptions - #4096

Open
ppkarwasz wants to merge 2 commits into
CVEProject:devfrom
ppkarwasz:feat/html-descriptions
Open

ppkarwasz wants to merge 2 commits into
CVEProject:devfrom
ppkarwasz:feat/html-descriptions

Conversation

@ppkarwasz

@ppkarwasz ppkarwasz commented Oct 8, 2026 •

Copy link
Copy Markdown

The CVE record page always shows the plain-text value of the CNA description. Line breaks, lists and indentation collapse into a single paragraph, which makes structured descriptions hard to read (e.g. CVE-2025-68161).

Changes

  • HTML descriptions: if the English description has a text/html entry in supportingMedia, it is decoded (when base64: true), sanitized with DOMPurify and rendered as HTML. The sanitizer keeps only formatting, list, table and link elements; scripts, event handlers, styles, images, iframes, forms, SVG and javascript: URLs are removed. Links open in a new tab with rel="noopener noreferrer nofollow".
  • Plain-text descriptions: rendered in a monospace font with white-space: pre-wrap, so line breaks, indentation and ASCII diagrams are preserved, while long lines still wrap.

This adds dompurify as a dependency.

How to test

Search results still show the plain-text summary.

Screenshots

CVE-2025-68161 (Apache Log4j, HTML):

obraz

CVE-2024-49882 (Linux kernel, plain text):

obraz

CVE-2025-54920 (Apache Spark, HTML with <pre>):

obraz

🤖 Generated with Claude Code

The CVE record page always showed the plain-text `value` of the CNA
description, collapsing its line breaks, lists and indentation.

- If the English description has a `text/html` supporting media entry,
  it is decoded (when base64-encoded), sanitized with DOMPurify using a
  strict allowlist of formatting, list, table and link elements, and
  rendered as HTML. Links open in a new tab with
  `rel="noopener noreferrer nofollow"`.
- Otherwise the plain-text description is rendered in a monospace font
  with `white-space: pre-wrap`, so line breaks, indentation and ASCII
  diagrams are preserved while long lines still wrap.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the sanitizer options into a constant typed with DOMPurify's
`Config`, so misspelled option names are caught at compile time.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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