fix(client): fix polynomial regular expression used on uncontrolled data#1330
Merged
remarkablemark merged 4 commits intomasterfrom Feb 6, 2026
Merged
fix(client): fix polynomial regular expression used on uncontrolled data#1330remarkablemark merged 4 commits intomasterfrom
remarkablemark merged 4 commits intomasterfrom
Conversation
Contributor
size-limit report 📦
|
bfe3616 to
85af67b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1330 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 138 149 +11
Branches 34 41 +7
=========================================
+ Hits 138 149 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
https://github.com/remarkablemark/html-dom-parser/security/code-scanning/22 https://github.com/remarkablemark/html-dom-parser/security/code-scanning/23 https://github.com/remarkablemark/html-dom-parser/security/code-scanning/24 https://github.com/remarkablemark/html-dom-parser/security/code-scanning/25
85af67b to
488bf7c
Compare
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.
What is the motivation for this pull request?
Fixes https://github.com/remarkablemark/html-dom-parser/security/code-scanning/22
Fixes https://github.com/remarkablemark/html-dom-parser/security/code-scanning/23
Fixes https://github.com/remarkablemark/html-dom-parser/security/code-scanning/24
Fixes https://github.com/remarkablemark/html-dom-parser/security/code-scanning/25
What is the current behavior?
Polynomial regular expression used on uncontrolled data
This regular expression that depends on library input may run slow on strings starting with
<head/<bodyand with many repetitions of<head/<body:The
[^]*pattern matches any character (including newlines) zero or more times, which can cause ReDoS (Regular Expression Denial of Service) on malicious input due to catastrophic backtracking with the>terminator.What is the new behavior?
The fix is to replace the negated character class with a pattern that properly handles quoted attributes without backtracking.
This eliminates the polynomial time complexity while maintaining correct behavior for tags with attributes.
Checklist: