Skip to content

fix(stream): wait for closing quote of split attribute value - #42

Merged
nikku merged 2 commits into
mainfrom
nikku-fix-streaming-quoted-attribute
Nov 27, 2026
Merged

nikku merged 2 commits into
mainfrom
nikku-fix-streaming-quoted-attribute

Conversation

@nikku

@nikku nikku commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Proposed Changes

In streaming mode (Parser#write / #end), a > inside an attribute value ended the tag if the closing quote had not arrived yet. Chunked parsing then diverged from whole-document parsing, e.g. <a v="x> + <b/>y"/> emitted a fake <b/> element. The parser now buffers the tag and waits for the next chunk; non-streaming parsing is unchanged.

Adds regression tests that parse documents whole, at every two-way split, and char-by-char, asserting identical events.

Fixes GHSA-9phx-3fcw-32vf

Checklist

Ensure you provide everything we need to review your contribution:

  • Contribution meets our definition of done
  • Pull request establishes context
    • Link to related issue(s), i.e. Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}
    • Brief textual description of the changes
    • Screenshots or short videos showing UI/UX changes
    • Steps to try out, i.e. using the @bpmn-io/sr tool

nikku and others added 2 commits November 26, 2026 22:55
Previously, in streaming mode, a `>` inside an attribute value would
end the tag if the closing quote was not yet written, causing chunked
parsing to diverge from whole-document parsing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@nikku
nikku requested a balanced review from Copilot November 27, 2026 19:33
@nikku nikku self-assigned this Nov 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The review has no active issues for the streaming XML attribute-parsing fix.

No open issues 🎉

What changed in this PR

Fixes streaming XML parsing so a > inside an attribute value does not prematurely end the tag when the closing quote arrives in a later chunk. Non-streaming parsing remains unchanged.

Changes:

  • Buffer incomplete quoted values until more input arrives, preventing embedded markup from producing spurious element events.
  • Add regression tests comparing events and warnings across single-chunk, every two-way split, and character-by-character input.
  • Document the fix and link the security advisory in the changelog.
File Description
test/​stream.js Capture warnings and test quoted attribute values across chunk boundaries.
lib/​parser.js Wait for missing closing quotes during streaming instead of accepting an embedded > as the tag end.
CHANGELOG.md Record the streaming fix and associated security advisory.

Review effort: Balanced

@nikku
nikku merged commit 149ddd3 into main Nov 27, 2026
7 checks passed
@nikku
nikku deleted the nikku-fix-streaming-quoted-attribute branch November 27, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants