Repository navigation
fix(stream): wait for closing quote of split attribute value - #42
Merged
Merged
Conversation
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>
There was a problem hiding this comment.
🟢 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-32vfChecklist
Ensure you provide everything we need to review your contribution:
Closes {LINK_TO_ISSUE}orRelated to {LINK_TO_ISSUE}@bpmn-io/srtool