Repository navigation
fix: an edit cycle could hang serialization, and selectors could crawl - #96
Merged
Merged
Conversation
Syncs Netweir 75b8681, which brings: - netweir/netweir#333: fixes for the four findings of the parser's security review (#58). An edit could put a template inside its own contents, after which outer_html and text() never returned. A long descendant chain overflowed the stack while matching. :has() and :nth-child(of S) were quadratic. Matching is now iterative, those two are linear, and MatchOptions takes an optional time budget. - netweir/netweir#332: parse read the clock even without a budget, which panics on wasm32-unknown-unknown. The Python bindings built MatchOptions with a struct literal, so they fill the new budget field with its default.
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.
Problem
The security review for #58 found four ways untrusted input could hurt a caller:
append(template_contents(t), t)passed the cycle check, soouter_htmlandtext()never returned.div:has(b)and:nth-child(… of S)took time quadratic in the tree.Also,
parseread the clock on every call, which panics in WebAssembly and blocks #24.Change
Syncs Netweir 75b8681:
:has()and:nth-child(of S)are linear.MatchOptionshas an optionalbudget, withtry_select_withandtry_matches_withreturningMatchTimeout.bindings/python: fills the newbudgetfield with..MatchOptions::default().Tests
cargo test --workspace: 213 test groups, 0 failed. Tokenizer 7,045 and tree construction 3,898 passed, 0 failed.:has()and:nth-*;bindings/pythonbuilds and passes clippy.