Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Known bad worst-case regular expression instances #259

Open
2 tasks
ericcornelissen opened this issue Feb 1, 2022 · 1 comment
Open
2 tasks

Known bad worst-case regular expression instances #259

ericcornelissen opened this issue Feb 1, 2022 · 1 comment
Labels
package/language-html Relates to packages/language-html performance Changes to improve performance

Comments

@ericcornelissen
Copy link
Owner

ericcornelissen commented Feb 1, 2022

Performance

Package Version
language-html ^0.1.23

Description

There are known instances of regular expressions with bad (exponential) worst-case performance in the WebMangler code base. These don't apply to normal inputs - regular code snippets - and so are not considered a bug or security issue but rather a performance issue that would ideally be fixed.

⚠️ Anyone using WebMangler on untrusted input should consider this a security issue and take necessary precautions to prevent ReDoS attacks.

This issue is intended to track known bad (parts of) regular expressions so they can be addressed individually/in groups.

Participating

If you find an instance of a regular expression that has a bad worst-case performance feel free to leave a comment and it'll be added to the list.

If you know how to fix one/a group of these, feel free to open a Pull Request with a fix. Try to clearly communicate which instances in this issue are addressed by your fix. If possible, add or update performance tests to prevent re-introduction of the worst-case regular expression in the future.

Overview

language-html

  • style-tag.ts:L8: Exponential backtracking on strings starting with "'<script>;</script'" followed by many repetitions of "" or ''.
  • script-tag.ts:L8: Exponential backtracking on strings starting with "'<style>;</style'" followed by many repetitions of "" or ''.

Related

@ericcornelissen ericcornelissen added performance Changes to improve performance package/language-html Relates to packages/language-html labels Feb 1, 2022
@ericcornelissen

This comment was marked as outdated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package/language-html Relates to packages/language-html performance Changes to improve performance
Projects
None yet
Development

No branches or pull requests

1 participant