Cross-Site Scripting in google-closure-libraryGHSA-r9q4-w3fm-wrm2
Fix: google/closure-library@c79ab48GHSA-r9q4-w3fm-wrm2 is a security vulnerability in google-closure-library. A fix is available for google-closure-library — see the affected versions and patch details below.
Real-World Exposure
google-closure-libraryReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects npm packages — download data is not available via public APIs for these ecosystems.
Description
Versions of google-closure-library prior to 20190301.0.0 are vulnerable to Cross-Site Scripting. The safedomtreeprocessor.processToString() function improperly processed empty elements, which could allow attackers to execute arbitrary JavaScript through Mutation Cross-Site Scripting.
Recommendation
Upgrade to version 20190301.0.0 or later.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | google-closure-library | all versions | 20190301.0.0npm install google-closure-library@20190301.0.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for google-closure-library, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update google-closure-library to 20190301.0.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-r9q4-w3fm-wrm2 is resolved across your whole dependency graph.
Workarounds
Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
Frequently Asked Questions
Is GHSA-r9q4-w3fm-wrm2 in your dependencies?
Find it across npm, including transitive dependencies.