Escape operationId in query/mutation mutator options (GHSA-vv88-cm6j-665j)
fix: escape operationId in query/mutation mutator options (GHSA-vv88-cm6j-665j) (#4008)
Escape operationId in query/mutation mutator options (GHSA-vv88-cm6j-665j)b28c53-fix-escape-operationid-in-query-mutation-mutator-cve-2026-96759fixescape operationid query mutation mutator options
Committed by melloware
commit message
fix: escape operationId in query/mutation mutator options (GHSA-vv88-cm6j-665j) (#4008)
getOperationId returns the OpenAPI operationId verbatim and nothing sanitizes
it downstream, unlike operationName which goes through sanitize(). All three
sites that pass the mutator its third argument emitted it into a single-quoted
literal inside an object the generated hook builds at call time, so a quote in
the spec closed the string and injected entries -- and expressions -- into that
object:
{ url: `/pets`, operationId: 'getPets',x:(()=>{ ... })(),y:'', ... }
Route both values through a getOperationMetaLiteral helper that escapes for the
literal they land in. operationName is escaped too: sanitize() covers the
spec-derived path, but an override.operations[...].operationName function can
return arbitrary text, and escaping at the emission site makes it correct
regardless of what upstream does.
The sibling `url` in the same object was already escaped for its backtick
context, and is unaffected.
Reported-by: manus-use
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>Editor assessment
This commit patches CVE-2026-96759. The body explains the distinction that matters: getOperationId returns spec text verbatim while operationName is sanitized, all three mutator sites emitted the value into a single-quoted literal, and a quote could inject entries and expressions into the generated object. It then describes the getOperationMetaLiteral helper and why escaping at the emission site is the robust fix. Clear and specific. Style-wise the message is clean and the body is specific and separated; no formal improvement is needed.