The vulnerability lies in the @orval/core package, where unsanitized data from an OpenAPI specification is used to generate client-side code. The analysis of the provided patch commit 9e5d93533904936678ba93b5d20f6bca176a4e1e reveals that the functions getEnumDescriptions and getEnumNames in packages/core/src/getters/enum.ts were responsible for reading potentially malicious values from the OpenAPI schema.
The vulnerability description explicitly mentions that the x-enumDescriptions field is embedded without proper escaping in getEnumImplementation(). The patch confirms this by showing that getEnumDescriptions (and also getEnumNames) originally returned the raw values. An attacker could provide a malicious string containing JavaScript code in the x-enumDescriptions or x-enumNames fields of an OpenAPI document. When Orval processes this document, these functions would read the malicious string, which would then be embedded into the generated TypeScript/JavaScript code, leading to arbitrary code execution in the environment that consumes the generated client.
The fix involves calling a newly imported jsStringEscape function on each description and name, which neutralizes any special characters and prevents them from being interpreted as code. Therefore, during exploitation, the getEnumDescriptions and getEnumNames functions would be the ones processing the malicious input just before it gets injected.