Versions of jsondiffpatch prior to 0.7.2 are vulnerable to Cross-site Scripting (XSS) in the HtmlFormatter (HtmlFormatter::nodeBegin). When diffs are rendered to HTML using the built-in formatter, untrusted payloads can inject scripts and execute in the context of a consuming web page.
Affected versions: >= 0, < 0.7.2
Patched version: 0.7.2
Remediation
Upgrade to jsondiffpatch 0.7.2 or later. The fix hardens the HTML formatter to avoid script injection.
Workarounds
Avoid using the HTML formatter on untrusted diffs, or sanitize/escape the rendered output.
| Score | Percentile |
|---|---|
| 0.04% | 11.66% |
| Base score | Version | Severity | Vector |
|---|---|---|---|
| 4.7 | 3.1 | — |
|
| 5.3 | 4.0 | — |
|
| Type | Value |
|---|---|
| GHSA | GHSA-33vc-wfww-vjfv ↗ |
| CVE | CVE-2025-9910 ↗ |
| CWE id | Name |
|---|---|
| CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') |
Vulnerable version ranges and first patched releases as published by GitHub.
| Ecosystem | Package | Vulnerable range | First patched | Vulnerable functions |
|---|---|---|---|---|
| npm | jsondiffpatch | < 0.7.2 | 0.7.2 | — |