CVE-2026-54666: swagger-typescript-api vulnerable to code injection via unescaped OpenAPI path strings in generated method bodies
swagger-typescript-api interpolates OpenAPI path strings (the keys of the paths object, e.g. /users/{id}) directly into a JavaScript template literal inside the body of every generated API method, without escaping. A spec path containing ${ … } survives parseRouteName’s {x} / :x rewriter verbatim and lands as live JS-template-literal interpolation inside the generated path: \…`` line. Any consumer who calls the affected generated method evaluates the attacker’s expression with full importer privileges — file read/write, exfiltration, etc. The attacker controls the OpenAPI spec (remote URL, third-party / public spec, multi-tenant platform); the victim is whoever runs the generator and uses the resulting client.
References
- github.com/acacode/swagger-typescript-api/commit/306d59acb8ffbb00f953f807b97234b21f51d9de
- github.com/acacode/swagger-typescript-api/pull/1779
- github.com/acacode/swagger-typescript-api/releases/tag/v13.12.2
- github.com/acacode/swagger-typescript-api/security/advisories/GHSA-w284-33mx-6g9v
- github.com/advisories/GHSA-w284-33mx-6g9v
- nvd.nist.gov/vuln/detail/CVE-2026-54666
Code Behaviors & Features
Detect and mitigate CVE-2026-54666 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →