| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
… single stream chunk A regular expression that can match two or more characters, applied to one chunk of a stream with nothing carried from the previous chunk, never sees a value that straddles two chunks. Flags per-chunk callbacks (Transform, TransformStream, 'data' listeners, for-await loops) where the chunk flows to such a pattern. Includes query help, examples and a test.
| Back | FazBrowse Home | New Git URL |
Summary
Adds javascript/ql/src/experimental/Security/CWE-693/SplitBoundaryChunkFilter.ql
(js/split-boundary-chunk-filter, path-problem, precision medium) with query help, examples
and a test.
A stream arrives in chunks whose boundaries are chosen by the sender or transport. A filter
that applies a regular expression to each chunk on its own never sees a value that straddles
two chunks, so a redaction filter forwards it and a blocking filter lets it through. Whole-string
tests pass, which is why the defect survives review. It was found and fixed independently in
several streaming guardrail frameworks this year and reappears in general stream replacers and
secret scanners; the mechanism is the one described for network intrusion detection in 1998.
What the query does
(_transform, _write, or the transform/write option), web TransformStream
transformers, through2-style callbacks, 'data' listeners, and for await loop variables;
plus the part of a Mastra processOutputStream processor as one framework example.
and across calls.
expression that can match two or more characters (resolved through RegExp::getRegExpFromNode),
and test/exec; for test/exec with an unresolvable receiver the alert says the pattern
width is unknown.
an accumulated buffer, because data flow does not pass through string concatenation. That is
the fix shape the help recommends.
Evaluation
single-character pattern, non-stream code, pattern on an unrelated string) not flagged.
is correct: the original per-chunk version used an LLM call rather than a regular expression,
and the later revisions carry a tail. I have no confirmed open-source hit for the regex form
yet; the query encodes the defect class, and I would welcome pointers to projects to run it on.
Checklist
happy to add if required