Vega Cross-Site Scripting (XSS) via event filter when not using CSP mode `expressionInterpeter`
Description
Vega is a visualization grammar, a declarative format for creating, saving, and sharing interactive visualization designs. In vega 5.30.0 and lower and in vega-functions 5.15.0 and lower , it was possible to call JavaScript functions from the Vega expression language that were not meant to be supported. The issue is patched in vega 5.31.0 and vega-functions 5.16.0. Some workarounds are available. Run vega without vega.expressionInterpreter. This mode is not the default as it is slower. Alternatively, using the interpreter described in CSP safe mode (Content Security Policy) prevents arbitrary Javascript from running, so users of this mode are not affected by this vulnerability.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
veganpm | < 5.31.0 | 5.31.0 |
vega-functionsnpm | < 5.16.0 | 5.16.0 |
Affected products
1Patches
12 files changed · +14 −11
packages/vega-functions/src/functions/scale-gradient.js+7 −2 modified@@ -3,8 +3,13 @@ import {scale as get, scaleFraction} from 'vega-scale'; import {Gradient} from 'vega-scenegraph'; import {identity, peek} from 'vega-util'; -export default function(scale, p0, p1, count, group) { - scale = getScale(scale, (group || this).context); +/** + * Passing a function is only used for for testing. + * Outside of tests, the first argument should be a string. + */ +export default function(scaleOrFunction, p0, p1, count, group) { + + let scale = typeof scaleOrFunction === 'string' ? getScale(scaleOrFunction, (group || this).context) : scaleOrFunction; const gradient = Gradient(p0, p1);
packages/vega-functions/src/scales.js+7 −9 modified@@ -1,19 +1,17 @@ import {ScalePrefix} from './constants'; import {scaleVisitor} from './visitors'; import {Literal} from 'vega-expression'; -import {isFunction, isString, stringValue} from 'vega-util'; +import {isString, stringValue} from 'vega-util'; import {isRegisteredScale} from 'vega-scale'; -export function getScale(nameOrFunction, ctx) { +/** + * Name must be a string. Return undefined if the scale is not registered. + */ +export function getScale(name, ctx) { - if (isFunction(nameOrFunction)) { - return nameOrFunction; - } - - if (isString(nameOrFunction)) { - const maybeScale = ctx.scales[nameOrFunction]; + if (isString(name)) { + const maybeScale = ctx.scales[name]; return (maybeScale && isRegisteredScale(maybeScale.value)) ? maybeScale.value : undefined; - } return undefined;
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/advisories/GHSA-rcw3-wmx7-cphrghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-26619ghsaADVISORY
- github.com/vega/vega-lite/issues/9469ghsax_refsource_MISCWEB
- github.com/vega/vega/commit/8fc129a6f8a11e96449c4ac0f63de0e5bfc7254cghsax_refsource_MISCWEB
- github.com/vega/vega/issues/3984ghsax_refsource_MISCWEB
- github.com/vega/vega/security/advisories/GHSA-rcw3-wmx7-cphrghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.