A Stored Cross-Site Scripting (XSS) vulnerability exists in the OpenAPI documentation generation of orpc. If an attacker can control any field within the OpenAPI specification (such as info.description), they can break out of the JSON context and execute arbitrary JavaScript when a user views the generated API documentation. In the packages/openapi/src/plugins/openapi-reference.ts file, the renderDocsHtml() function takes an OpenAPI spec object and embeds it directly into the HTML response using a template literal:
<script id="spec" type="application/json">${JSON.stringify(spec)}</script>
The JSON.stringify() function does not escape HTML characters like < or >. Therefore, if an attacker provides a string containing
{
"cwe_ids": [
"CWE-79"
],
"github_reviewed": true,
"github_reviewed_at": "2026-03-20T17:25:56Z",
"nvd_published_at": "2026-03-24T20:16:28Z",
"severity": "HIGH"
}