Executive brief
Orval is a code generation tool that creates API client libraries from OpenAPI specifications. The tool fails to properly escape metadata fields when generating TypeScript/JavaScript enum code, allowing attackers who control the API specification to inject arbitrary code that executes during client generation. This could lead to complete compromise of any system using Orval to generate clients from untrusted API specifications.
Technical details
The vulnerability is a code injection flaw (CWE-94) in the getEnumImplementation() function of @orval/core. The x-enumDescriptions field from OpenAPI specifications is embedded directly into generated TypeScript/JavaScript enum code without sanitization or escaping. An attacker can craft a malicious OpenAPI specification containing JavaScript code within the x-enumDescriptions field (e.g., `require('child_process').execSync()`), which will be executed in the generated schema files when the code is generated. The attack requires an attacker to control or influence the OpenAPI specification consumed by Orval, but requires no authentication or user interaction beyond running the generation tool. Patches are available in versions 7.19.0 and 8.0.2.
Affected products
- Orval Labs @orval/core All versions before 7.19.0 and 8.0.0-rc.0 through before 8.0.2
Timeline
- 2026-01-21: disclosed: GHSA published
- 2026-01-21: patched: Fixed in versions 7.19.0 and 8.0.2