Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. @typespec/openapi3
  4. ›
  5. GHSA-2q42-4q24-7rgv

GHSA-2q42-4q24-7rgv: OpenAPI3 version value escapes `emitterOutputDir` and overwrites YAML/JSON outside the output tree

September 8, 2026

The @typespec/openapi3 emitter retains the value of a @versioned enum member and interpolates it into the output filename as {version} without sanitizing path separators or traversal components. The completed path reaches the compiler’s emitFile(), which creates the parent directory and writes the file without verifying containment under emitterOutputDir.

A crafted declarative .tsp input can therefore create or overwrite an OpenAPI-formatted .yaml or .json file outside the configured output tree, subject to the compiler process’s filesystem permissions. No executable TypeSpec extension or attacker-controlled JavaScript is required.

References

  • github.com/advisories/GHSA-2q42-4q24-7rgv
  • github.com/microsoft/typespec/commit/e0f67bdf3c5a0875dfa98b475648af37caac71a6
  • github.com/microsoft/typespec/pull/11777
  • github.com/microsoft/typespec/security/advisories/GHSA-2q42-4q24-7rgv

Code Behaviors & Features

Detect and mitigate GHSA-2q42-4q24-7rgv with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions up to 1.15.0

Solution

Unfortunately, there is no solution available yet.

Impact 7.1 HIGH

CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
  • CWE-73: External Control of File Name or Path

Source file

npm/@typespec/openapi3/GHSA-2q42-4q24-7rgv.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 22 Sep 2026 12:21:04 +0000.