/

CVE-2026-54660

Severity:

HIGH RISK

(7.4)

Token Exfiltration (CWE-200) via Remote OpenAPI Refs

CVE-2026-54660

Deferred

Vulnerability type

Category:

Sensitive Information Exposure

CWE:

CWE-200, CWE-201, CWE-522, CWE-918

Impact:

Credential and Token Exfiltration

Severity:

HIGH RISK

(7.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

swagger-typescript-api forwarded a supplied authorization token header to every URL used when resolving remote OpenAPI references.

When a malicious or compromised OpenAPI specification includes attacker-controlled external $ref URLs, this behavior can leak CI or developer bearer tokens to cross-origin endpoints, exposing sensitive credentials during client generation.

swagger-typescript-api forwarded a supplied authorization token header to every URL used when resolving remote OpenAPI references.

When a malicious or compromised OpenAPI specification includes attacker-controlled external $ref URLs, this behavior can leak CI or developer bearer tokens to cross-origin endpoints, exposing sensitive credentials during client generation.

Affected context

This vulnerability occurs in workflows where swagger-typescript-api is used to generate TypeScript API clients from OpenAPI specifications and the --authorizationToken (or equivalent) option is provided.

It is most relevant when:

  • OpenAPI specs reference external documents via $ref URLs
  • Those URLs are not strictly controlled or validated
  • The token represents sensitive CI/CD or developer credentials used to fetch protected schemas

In such setups, a malicious or untrusted spec can cause the generator to contact arbitrary remote endpoints while including the bearer token.

This vulnerability occurs in workflows where swagger-typescript-api is used to generate TypeScript API clients from OpenAPI specifications and the --authorizationToken (or equivalent) option is provided.

It is most relevant when:

  • OpenAPI specs reference external documents via $ref URLs
  • Those URLs are not strictly controlled or validated
  • The token represents sensitive CI/CD or developer credentials used to fetch protected schemas

In such setups, a malicious or untrusted spec can cause the generator to contact arbitrary remote endpoints while including the bearer token.

Exploit preconditions

  • Attack surface: swagger-typescript-api invocation in developer machines or CI pipelines.
  • Required access: Ability to supply or modify the OpenAPI spec consumed by the generator (e.g., via a compromised spec file, remote schema URL, or untrusted third-party spec).
  • Trigger point: Execution of swagger-typescript-api with an authorization token while warmUpRemoteSchemasCache resolves external $ref URLs through fetchRemoteSchemaDocument.
  • Why exploitation is possible: The implementation forwards the same authorization header to all remote schema fetches without scoping it to the intended origin, allowing attacker-controlled endpoints embedded in $ref to receive the bearer token.
  • Attack surface: swagger-typescript-api invocation in developer machines or CI pipelines.
  • Required access: Ability to supply or modify the OpenAPI spec consumed by the generator (e.g., via a compromised spec file, remote schema URL, or untrusted third-party spec).
  • Trigger point: Execution of swagger-typescript-api with an authorization token while warmUpRemoteSchemasCache resolves external $ref URLs through fetchRemoteSchemaDocument.
  • Why exploitation is possible: The implementation forwards the same authorization header to all remote schema fetches without scoping it to the intended origin, allowing attacker-controlled endpoints embedded in $ref to receive the bearer token.

Why this happens

The underlying bug class is sensitive information exposure caused by improper handling and propagation of authentication headers during remote resource resolution.

In swagger-typescript-api, getRemoteRequestHeaders forwards the --authorizationToken value to every URL fetched when resolving remote schema documents, regardless of origin or trust level.

This maps to CWE-200: Exposure of Sensitive Information and CWE-918: Server-Side Request Forgery patterns, where internal credentials are sent to attacker-chosen endpoints.

Conceptually, the insecure pattern is treating an authorization token as a general-purpose header for all outgoing HTTP requests instead of constraining it to the specific trusted host or using a distinct, scoped credential.

The underlying bug class is sensitive information exposure caused by improper handling and propagation of authentication headers during remote resource resolution.

In swagger-typescript-api, getRemoteRequestHeaders forwards the --authorizationToken value to every URL fetched when resolving remote schema documents, regardless of origin or trust level.

This maps to CWE-200: Exposure of Sensitive Information and CWE-918: Server-Side Request Forgery patterns, where internal credentials are sent to attacker-chosen endpoints.

Conceptually, the insecure pattern is treating an authorization token as a general-purpose header for all outgoing HTTP requests instead of constraining it to the specific trusted host or using a distinct, scoped credential.

Potential impact

  • Attackers may obtain CI/CD bearer tokens or developer access tokens.
  • Compromised tokens could allow unauthorized access to private repositories, registries, or build artifacts.
  • Attackers can potentially modify build outputs, tamper with generated client code, or alter deployment configurations.
  • Subsequent lateral movement within development or production environments can occur if the leaked token has broad permissions.
  • Long-lived or highly privileged tokens can be reused for persistent unauthorized access until revoked.
  • Attackers may obtain CI/CD bearer tokens or developer access tokens.
  • Compromised tokens could allow unauthorized access to private repositories, registries, or build artifacts.
  • Attackers can potentially modify build outputs, tamper with generated client code, or alter deployment configurations.
  • Subsequent lateral movement within development or production environments can occur if the leaked token has broad permissions.
  • Long-lived or highly privileged tokens can be reused for persistent unauthorized access until revoked.

General mitigation guidance

Effective mitigation focuses on limiting where and how sensitive headers are propagated and reducing trust in external schema references.

Common defensive patterns include:

  • Scoping authorization tokens to specific, trusted origins rather than attaching them to all remote requests.
  • Separating credentials used to fetch protected schemas from general HTTP traffic, using distinct configuration with strict host allowlists.
  • Treating external $ref URLs as untrusted input and validating or restricting them through explicit allowlists or domain filters.
  • Using non-sensitive, short-lived tokens or anonymized access mechanisms for schema retrieval when possible.
  • Ensuring generators and tooling are configured with least-privilege credentials and minimal network exposure.
  • Building secure-by-default wrappers that strip or override headers for cross-origin or non-allowlisted requests.

Effective mitigation focuses on limiting where and how sensitive headers are propagated and reducing trust in external schema references.

Common defensive patterns include:

  • Scoping authorization tokens to specific, trusted origins rather than attaching them to all remote requests.
  • Separating credentials used to fetch protected schemas from general HTTP traffic, using distinct configuration with strict host allowlists.
  • Treating external $ref URLs as untrusted input and validating or restricting them through explicit allowlists or domain filters.
  • Using non-sensitive, short-lived tokens or anonymized access mechanisms for schema retrieval when possible.
  • Ensuring generators and tooling are configured with least-privilege credentials and minimal network exposure.
  • Building secure-by-default wrappers that strip or override headers for cross-origin or non-allowlisted requests.

How teams detect issues like this

Organizations can detect similar issues by:

  • Reviewing tool configurations and build scripts for patterns where authorization headers or tokens are forwarded to arbitrary URLs without origin checks.
  • Implementing static analysis or policy-as-code checks (e.g., in CI) that flag use of broad authorization options on generators, linters, or documentation tools that perform remote HTTP requests.
  • Auditing OpenAPI specifications for external $ref URLs pointing to unexpected domains, especially in third-party or vendor-supplied specs.
  • Using HTTP proxy logs or egress monitoring to identify sensitive headers being sent to non-trusted hosts during build or generation phases.
  • Employing automated code and configuration review tools that highlight cross-origin requests carrying authentication headers or secrets.

Organizations can detect similar issues by:

  • Reviewing tool configurations and build scripts for patterns where authorization headers or tokens are forwarded to arbitrary URLs without origin checks.
  • Implementing static analysis or policy-as-code checks (e.g., in CI) that flag use of broad authorization options on generators, linters, or documentation tools that perform remote HTTP requests.
  • Auditing OpenAPI specifications for external $ref URLs pointing to unexpected domains, especially in third-party or vendor-supplied specs.
  • Using HTTP proxy logs or egress monitoring to identify sensitive headers being sent to non-trusted hosts during build or generation phases.
  • Employing automated code and configuration review tools that highlight cross-origin requests carrying authentication headers or secrets.

Sources

SourceLink
github.comgithub.com/acacode/swagger-typescript-api/commit/306d59acb8ffbb00f953f807b97234b21f51d9de
github.comgithub.com/acacode/swagger-typescript-api/pull/1779
github.comgithub.com/acacode/swagger-typescript-api/releases/tag/v13.12.2
github.comgithub.com/acacode/swagger-typescript-api/security/advisories/GHSA-h754-fxp7-88wx

Frequently asked

questions

It is exploitable through manipulation of the OpenAPI specification rather than direct remote access to the generator. An attacker who can provide or influence the spec used by swagger-typescript-api can cause token exfiltration when the tool runs in developer or CI environments.

The attacker needs the ability to control or modify the OpenAPI spec or its referenced documents. This could be through a compromised spec repository, a malicious remote schema URL, or any supply-chain scenario where untrusted specs are consumed by the generator with an authorization token configured.

The safest pattern is to avoid forwarding sensitive tokens to arbitrary remote endpoints. Constrain authorization headers to trusted origins via explicit allowlists, strip them for cross-origin or unvalidated $ref URLs, and separate credentials used for protected resources from generic HTTP requests in tooling.

Define clear trust boundaries for tooling that performs remote HTTP requests, treat specifications and external references as untrusted input, and enforce policies that:

  • Prohibit using high-privilege tokens in generation or documentation tools.
  • Require domain allowlists and header filtering for all outbound requests.
  • Integrate security reviews and automated checks into CI pipelines to flag risky configuration patterns and external $ref usage.

It is exploitable through manipulation of the OpenAPI specification rather than direct remote access to the generator. An attacker who can provide or influence the spec used by swagger-typescript-api can cause token exfiltration when the tool runs in developer or CI environments.

The attacker needs the ability to control or modify the OpenAPI spec or its referenced documents. This could be through a compromised spec repository, a malicious remote schema URL, or any supply-chain scenario where untrusted specs are consumed by the generator with an authorization token configured.

The safest pattern is to avoid forwarding sensitive tokens to arbitrary remote endpoints. Constrain authorization headers to trusted origins via explicit allowlists, strip them for cross-origin or unvalidated $ref URLs, and separate credentials used for protected resources from generic HTTP requests in tooling.

Define clear trust boundaries for tooling that performs remote HTTP requests, treat specifications and external references as untrusted input, and enforce policies that:

  • Prohibit using high-privilege tokens in generation or documentation tools.
  • Require domain allowlists and header filtering for all outbound requests.
  • Integrate security reviews and automated checks into CI pipelines to flag risky configuration patterns and external $ref usage.
Find out what's already
exploitable in your codebase.