@typespec/openapi3 · OpenAPI3 version value escapes `emitterOutputDir` and overwrites YAML/JSON outside the output tree
Affects @typespec/openapi3Source GCVE Database
CVSS 7.1 High : upgrade to 1.16.0 soon.
Data as of 1 Dec 2026, 15:33 UTC
- Patch
- Available – fixed in 1.16.0
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:HWhat to do
Upgrade @typespec/openapi3 and @typespec/compiler to 1.16.0.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| npm@typespec/openapi3 | Affected
| Fixed in
|
| npm@typespec/compiler | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
A patch is available in version 1.16.0 that addresses this vulnerability. The recommended remediation is to validate the fully interpolated output path against the emitterOutputDir and reject any paths that are not descendants. Additionally, sanitize or slugify any absolute paths, path separators, or traversal components in version-derived filename tokens. Users should upgrade to @typespec/openapi3 version 1.16.0 or later to mitigate this issue.
Description
A path traversal vulnerability in the @typespec/openapi3 emitter allows crafted version values to escape the configured output directory and overwrite YAML or JSON files elsewhere on the filesystem. This occurs because the version string is interpolated into output filenames without sanitizing path traversal components. The vulnerability affects versions prior to 1.16.0 and requires no executable code injection, only a maliciously crafted declarative input. The impact is limited to file creation or overwrite within the permissions of the compiler process, with no direct code execution or file disclosure claimed.
References
- github.com/microsoft/typespec/security/advisories/GHSA-2q42-4q24-7rgv (opens in a new tab)
- github.com/microsoft/typespec/pull/11777 (opens in a new tab)
- github.com/microsoft/typespec/commit/e0f67bdf3c5a0875dfa98b475648af37caac71a6 (opens in a new tab)
- github.com/microsoft/typespec (opens in a new tab)
- github.com/microsoft/typespec/releases/tag/typespec-stable@1.16.0 (opens in a new tab)