Details
Affected Versions
Ecosystem: npmPackage: stream-jsonConfirmed affected range: >= 2.0.0, <= 3.6.0Latest release checked: 3.6.0 (npm registry latest)Fix status: not fixed
FlexAssembler was introduced in 2.0.0; the 1.x line has no such component. The vulnerable compileFilter join branches, the uncapped key stack, and the absence of any depth guard are present and effectively identical across the 2.0.0 through 3.6.0 releases, including the current registry latest (3.6.0). No fixed release exists: the depth cap shipped for the related filter issue does not touch FlexAssembler, so every release in the range is affected and a future release remains affected until a FlexAssembler-side bound ships.
Suggested Fix
Enforce a nesting depth bound on the FlexAssembler assembly path, mirroring the maxDepth guard already used by the filter base state machine, so that pathologically deep input is rejected before it drives quadratic work. Alternatively, or in addition, eliminate the per-container full-stack join in compileFilter by maintaining the joined path incrementally (append the new segment on push, truncate on pop) or by comparing the key stack against the filter with a prefix walk that is O(1) amortized per container start rather than O(depth). Any fix must cover both the string and RegExp filter branches and both the object and array rule paths, on both the Node and Web Streams surfaces. As an interim mitigation without a code change, consumers can use function filters (which do not perform the join) or impose an upstream input size or depth limit before the parser.
---
Reported by zx (GitHub: @manus-pi).
---
Maintainer note on scope
The attack vector is local — stream-json's documented input is data the user owns (dumps, exports, logs, configuration you wrote); it is not designed for JSON from the open internet, and the docs say so. The crafted document reaches the vulnerable component as a buffer, so AV:L gives 6.2, the same vector and score as GHSA-528h-pc64-c93x and GHSA-hqr4-qq8f-hg3x. FlexAssembler now takes a maxDepth option, default 1024, which throws a RangeError before any rule is matched; Infinity opts out, and once rules are configured the cap covers containers of both kinds, because a rule's path state is kept at every level whatever kind it matches. A follow-up went past what the advisory needed and removed the per-check join entirely — a string filter keeps prefix-match state per level, a RegExp an accumulated path, a function filter the parts array it already received — so deeply nested input is linear now rather than merely capped.