@@ -7,6 +7,43 @@ This is the matching library used internally by npm.
77It works by converting glob expressions into JavaScript ` RegExp `
88objects.
99
10+ ## Important Security Consideration!
11+
12+ > [ !WARNING]
13+ > This library uses JavaScript regular expressions. Please read
14+ > the following warning carefully, and be thoughtful about what
15+ > you provide to this library in production systems.
16+
17+ _ Any_ library in JavaScript that deals with matching string
18+ patterns using regular expressions will be subject to
19+ [ ReDoS] ( https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS )
20+ if the pattern is generated using untrusted input.
21+
22+ Efforts have been made to mitigate risk as much as is feasible in
23+ such a library, providing maximum recursion depths and so forth,
24+ but these measures can only ultimately protect against accidents,
25+ not malice. A dedicated attacker can _ always_ find patterns that
26+ cannot be defended against by a bash-compatible glob pattern
27+ matching system that uses JavaScript regular expressions.
28+
29+ To be extremely clear:
30+
31+ > [ !WARNING]
32+ > ** If you create a system where you take user input, and use
33+ > that input as the source of a Regular Expression pattern, in
34+ > this or any extant glob matcher in JavaScript, you will be
35+ > pwned.**
36+
37+ A future version of this library _ may_ use a different matching
38+ algorithm which does not exhibit backtracking problems. If and
39+ when that happens, it will likely be a sweeping change, and those
40+ improvements will ** not** be backported to legacy versions.
41+
42+ In the near term, it is not reasonable to continue to play
43+ whack-a-mole with security advisories, and so any future ReDoS
44+ reports will be considered "working as intended", and resolved
45+ entirely by this warning.
46+
1047## Usage
1148
1249``` js
0 commit comments