Description
swagger-typescript-api generates API clients for Fetch or Axios from OpenAPI specifications. Prior to 13.12.2, src/code-gen-process.ts createApiConfig copies servers[0].url into apiConfig.baseUrl, and templates/base/http-clients/fetch-http-client.ejs interpolates apiConfig.baseUrl into the generated HttpClient baseUrl field without escaping, allowing an attacker-controlled OpenAPI spec to inject TypeScript static field code that executes when the generated fetch client module is imported. This issue is fixed in version 13.12.2.
Published: 2026-07-29
Score: 8.3 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

swagger-typescript-api, an open source tool that generates API clients for Fetch or Axios, contains a code injection vulnerability in versions before 13.12.2. The generator copies the first server URL from the OpenAPI specification into a configuration variable and then directly interpolates that value into the generated TypeScript source for the HTTP client. Because the URL is not escaped, an attacker who can supply a malicious OpenAPI specification can embed arbitrary TypeScript code into the client module, which will be executed when the module is imported. This flaw allows remote code execution on any system that compiles or runs the generated client, with full privileges of the process that imports it. The weakness aligns with CWE-1336 (Code Injection), CWE-74 (Improper Sanitization of String), and CWE-94 (Improper Control of Generation of Code).

Affected Systems

All releases of acacode swagger-typescript-api prior to v13.12.2 are affected. The issue is fixed in version 13.12.2 and later, so any project using an older version of swagger-typescript-api should consider updating immediately.

Risk and Exploitability

The CVSS score of 8.3 signals a high severity vulnerability, yet the EPSS score of less than 1% indicates a low likelihood of public exploitation at present. Because the flaw requires control over the OpenAPI specification that is passed to the generator, it most likely targets code‑generation pipelines or development environments where an attacker can inject malicious content. The vulnerability is not listed in CISA’s KEV catalog, and no public exploits are reported. Nevertheless, the potential for executing arbitrary code upon client import makes it a critical concern for any project that processes untrusted specifications.

Generated by OpenCVE AI on August 3, 2026 at 13:18 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade to swagger-typescript-api v13.12.2 or newer
  • Ensure that OpenAPI specifications are obtained from trusted sources or sanitized before being processed by the code generator
  • Isolate the code‑generation process in a controlled environment to prevent accidental execution of injected TypeScript, or manually review the generated client code for suspicious patterns

Generated by OpenCVE AI on August 3, 2026 at 13:18 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-hqj5-cw9f-rx67 swagger-typescript-api vulnerable to code injection via unescaped `servers[0].url` in fetch http-client template
History

Thu, 30 Jul 2026 14:30:00 +0000

Type Values Removed Values Added
First Time appeared Acacode
Acacode swagger-typescript-api
Vendors & Products Acacode
Acacode swagger-typescript-api

Wed, 29 Jul 2026 16:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Wed, 29 Jul 2026 14:45:00 +0000

Type Values Removed Values Added
Description swagger-typescript-api generates API clients for Fetch or Axios from OpenAPI specifications. Prior to 13.12.2, src/code-gen-process.ts createApiConfig copies servers[0].url into apiConfig.baseUrl, and templates/base/http-clients/fetch-http-client.ejs interpolates apiConfig.baseUrl into the generated HttpClient baseUrl field without escaping, allowing an attacker-controlled OpenAPI spec to inject TypeScript static field code that executes when the generated fetch client module is imported. This issue is fixed in version 13.12.2.
Title swagger-typescript-api vulnerable to code injection via unescaped `servers[0].url` in fetch http-client template
Weaknesses CWE-1336
CWE-74
CWE-94
References
Metrics cvssV3_1

{'score': 8.3, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H'}


Subscriptions

Acacode Swagger-typescript-api
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-29T15:16:06.092Z

Reserved: 2026-06-15T20:16:46.199Z

Link: CVE-2026-54662

cve-icon Vulnrichment

Updated: 2026-07-29T15:16:00.707Z

cve-icon NVD

Status : Deferred

Published: 2026-07-29T15:16:25.577

Modified: 2026-07-30T19:23:14.707

Link: CVE-2026-54662

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-03T13:30:04Z

Weaknesses
  • CWE-1336

    Improper Neutralization of Special Elements Used in a Template Engine

  • CWE-74

    Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

  • CWE-94

    Improper Control of Generation of Code ('Code Injection')