GHSA-22q9-hqm5-mhmc
MEDIUMCross-Site Scripting in swagger-ui
Versions of swagger-ui prior to 2.2.1 are vulnerable to Cross-Site Scripting (XSS). The package fails to encode output in GET requests. The request is meant to respond with Content-Type application/json which does not trigger the vulnerability but if the web server changes the header to text/html it may allow attackers to execute arbitrary JavaScript.
Recommendation
Upgrade to version 2.2.1 or later.
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| OSV | npm | swagger-ui | < 2.2.1 | 2.2.1 |
References
- https://github.com/swagger-api/swagger-ui/issues/1154 · WEB
- https://github.com/swagger-api/swagger-ui · PACKAGE
- https://www.npmjs.com/advisories/987 · WEB
History
- 25 Nov 2026 20:10 UTC · OSV: first stored (published 11 Sep 2020)