swagger-typescript-api
Ecosystem: npm
Downloads: 2.39 Mln
- 0CriticalAffects 0 versions
- 5HighAffects 5 versions
- 0MediumAffects 0 versions
- 1ModerateAffects 1 version
- 0LowAffects 0 versions
- Critical0 (0.0%)
- High5 (83.3%)
- Medium0 (0.0%)
- Moderate1 (16.7%)
- Low0 (0.0%)
Monthly breakdown
- 6 vulnerabilities
- Critical: 0
- High: 5
- Medium: 0
- Moderate: 1
- Low: 0
Vulnerabilities (6)
Known vulnerabilities affecting swagger-typescript-api, based on data from OSV.
| ID | Severity | Summary | Affected versions | Published | Source |
|---|---|---|---|---|---|
| GHSA-38c3-wv3c-v3xj | High | swagger-typescript-api vulnerable to code injection via unescaped `servers[0].url` in axios http-client template### Summary `swagger-typescript-api` interpolates `servers[0].url` directly into a TypeScript string literal inside the `HttpClient` constructor body of the generated **axios** client (`templates/base/http-clients/axios-http-client.ejs:71`), without any escaping. A malicious URL containing a `"` closes the string literal and exposes the surrounding *object-literal argument* of `axios.create({...})` to injection. A computed property key whose value is an IIFE executes arbitrary code every time `new HttpClient()` (or `new Api()`, which extends `HttpClient`) is constructed. The attacker controls |
| GitHub (opens in a new tab) | |
| GHSA-5f94-x226-ccpm | High | swagger-typescript-api vulnerable to code injection via unescaped enum string values### Summary `swagger-typescript-api` interpolates `components.schemas.*.enum[i]` string values into the body of generated TypeScript `enum` declarations without escaping. A malicious enum value can close the enclosing string literal, terminate the enum body, and inject a bare-block IIFE that executes at **module load** the first time the generated client is imported. The trigger requires no instantiation and no method call — only an `import` of the generated module. The attacker controls the OpenAPI spec (remote `--url`, third-party / public spec, multi-tenant platform); the victim is whoever |
| GitHub (opens in a new tab) | |
| GHSA-h754-fxp7-88wx | High | swagger-typescript-api vulnerable to authorization-token exfiltration via spec `$ref`### Summary When the developer supplies an `--authorizationToken` (commonly required to fetch a private spec behind authentication), `swagger-typescript-api` attaches that token to the `Authorization` header of **every** subsequent HTTP request it makes while resolving external `$ref` URLs in the spec — with **no same-origin check, no host allowlist, and no scope-down** for cross-origin requests. A malicious OpenAPI spec containing a `$ref` to an attacker-controlled URL therefore causes the developer's bearer token to be sent verbatim to that URL during code generation. The threat model is i |
| GitHub (opens in a new tab) | |
| GHSA-hqj5-cw9f-rx67 | High | swagger-typescript-api vulnerable to code injection via unescaped `servers[0].url` in fetch http-client template### Summary `swagger-typescript-api` interpolates `servers[0].url` directly into a TypeScript class-body field initializer of the generated **fetch** `HttpClient` (`templates/base/http-clients/fetch-http-client.ejs:75`), without any escaping. A malicious URL containing a `"` closes the string literal that initializes `public baseUrl` and exposes the surrounding *class body* to injection. The most direct exploit declares a new `static` field whose initializer is an async IIFE — TypeScript evaluates static field initializers at **class definition time**, which is at module load. A consumer who |
| GitHub (opens in a new tab) | |
| GHSA-w284-33mx-6g9v | High | swagger-typescript-api vulnerable to code injection via unescaped OpenAPI path strings in generated method bodies### Summary `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 t |
| GitHub (opens in a new tab) | |
| GHSA-x36r-4347-pm5x | Moderate | swagger-typescript-api vulnerable to Server-Side Request Forgery via spec `$ref`### Summary `swagger-typescript-api` walks every `$ref` value in the input OpenAPI spec and, for any `$ref` whose target is an `http(s)://` URL, issues an HTTP GET to that URL during generation (`warmUpRemoteSchemasCache`). The only URL filter is a regex that matches `^https?://` — there is **no private-IP allowlist, no DNS-rebinding protection, no redirect cap, and no same-origin check against the spec source**. A malicious OpenAPI spec can therefore force the generator process to issue HTTP requests to arbitrary hosts and paths reachable from the generator's network, including `127.0.0.1`, |
| GitHub (opens in a new tab) |
- GHSA-38c3-wv3c-v3xjHighswagger-typescript-api vulnerable to code injection via unescaped `servers[0].url` in axios http-client template
< 13.12.2
### Summary `swagger-typescript-api` interpolates `servers[0].url` directly into a TypeScript string literal inside the `HttpClient` constructor body of the generated **axios** client (`templates/base/http-clients/axios-http-client.ejs:71`), without any escaping. A malicious URL containing a `"` closes the string literal and exposes the surrounding *object-literal argument* of `axios.create({...})` to injection. A computed property key whose value is an IIFE executes arbitrary code every time `new HttpClient()` (or `new Api()`, which extends `HttpClient`) is constructed. The attacker controls
CVE: CVE-2026-54661
- GHSA-5f94-x226-ccpmHighswagger-typescript-api vulnerable to code injection via unescaped enum string values
< 13.12.2
### Summary `swagger-typescript-api` interpolates `components.schemas.*.enum[i]` string values into the body of generated TypeScript `enum` declarations without escaping. A malicious enum value can close the enclosing string literal, terminate the enum body, and inject a bare-block IIFE that executes at **module load** the first time the generated client is imported. The trigger requires no instantiation and no method call — only an `import` of the generated module. The attacker controls the OpenAPI spec (remote `--url`, third-party / public spec, multi-tenant platform); the victim is whoever
CVE: CVE-2026-54664
- GHSA-h754-fxp7-88wxHighswagger-typescript-api vulnerable to authorization-token exfiltration via spec `$ref`
< 13.12.2
### Summary When the developer supplies an `--authorizationToken` (commonly required to fetch a private spec behind authentication), `swagger-typescript-api` attaches that token to the `Authorization` header of **every** subsequent HTTP request it makes while resolving external `$ref` URLs in the spec — with **no same-origin check, no host allowlist, and no scope-down** for cross-origin requests. A malicious OpenAPI spec containing a `$ref` to an attacker-controlled URL therefore causes the developer's bearer token to be sent verbatim to that URL during code generation. The threat model is i
CVE: CVE-2026-54660
- GHSA-hqj5-cw9f-rx67Highswagger-typescript-api vulnerable to code injection via unescaped `servers[0].url` in fetch http-client template
< 13.12.2
### Summary `swagger-typescript-api` interpolates `servers[0].url` directly into a TypeScript class-body field initializer of the generated **fetch** `HttpClient` (`templates/base/http-clients/fetch-http-client.ejs:75`), without any escaping. A malicious URL containing a `"` closes the string literal that initializes `public baseUrl` and exposes the surrounding *class body* to injection. The most direct exploit declares a new `static` field whose initializer is an async IIFE — TypeScript evaluates static field initializers at **class definition time**, which is at module load. A consumer who
CVE: CVE-2026-54662
- GHSA-w284-33mx-6g9vHighswagger-typescript-api vulnerable to code injection via unescaped OpenAPI path strings in generated method bodies
< 13.12.2
### Summary `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 t
CVE: CVE-2026-54666
- GHSA-x36r-4347-pm5xModerateswagger-typescript-api vulnerable to Server-Side Request Forgery via spec `$ref`
< 13.12.2
### Summary `swagger-typescript-api` walks every `$ref` value in the input OpenAPI spec and, for any `$ref` whose target is an `http(s)://` URL, issues an HTTP GET to that URL during generation (`warmUpRemoteSchemasCache`). The only URL filter is a regex that matches `^https?://` — there is **no private-IP allowlist, no DNS-rebinding protection, no redirect cap, and no same-origin check against the spec source**. A malicious OpenAPI spec can therefore force the generator process to issue HTTP requests to arbitrary hosts and paths reachable from the generator's network, including `127.0.0.1`,
CVE: CVE-2026-54663