6
6
<overview >
7
7
<p >
8
8
Constructing a regular expression with unsanitized user input can be dangerous.
9
- A malicious user may be able to modify the meaning of the expression causing it
10
- to match unexpected strings and to construct large regular expressions by using
9
+ A malicious user may be able to modify the meaning of the expression, causing it
10
+ to match unexpected strings and construct large regular expressions by using
11
11
counted repetitions.
12
12
</p >
13
13
</overview >
@@ -22,13 +22,13 @@ escape meta-characters that have special meaning.
22
22
<p >
23
23
If purposefully supporting user supplied regular expressions, then use <a
24
24
href=" https://docs.rs/regex/latest/regex/struct.RegexBuilder.html#method.size_limit" >RegexBuilder::size_limit</a >
25
- to limit the pattern size such that it is no larger than necessary.
25
+ to limit the pattern size so that it is no larger than necessary.
26
26
</p >
27
27
</recommendation >
28
28
29
29
<example >
30
30
<p >
31
- The following example construct a regular expressions from the user input
31
+ The following example constructs a regular expressions from the user input
32
32
<code >key</code > without escaping it first.
33
33
</p >
34
34
@@ -41,16 +41,16 @@ malicious user might inject the regular expression <code>".*^|key"</code> and
41
41
unexpectedly cause strings such as <code >"key=secret"</code > to match.
42
42
</p >
43
43
<p >
44
- If user input is used to construct a regular expression it should be escaped
45
- first. This ensures that the user cannot insert characters that have special
44
+ If user input is used to construct a regular expression, it should be escaped
45
+ first. This ensures that the malicious users cannot insert characters that have special
46
46
meanings in regular expressions.
47
47
</p >
48
48
<sample src =" RegexInjectionGood.rs" />
49
49
</example >
50
50
51
51
<references >
52
52
<li >
53
- <code >regex</code > crate documentation: <a href =" https://docs.rs/regex/latest/regex/index.html#untrusted-patterns" >Untrusted patterns</a >
53
+ <code >regex</code > crate documentation: <a href =" https://docs.rs/regex/latest/regex/index.html#untrusted-patterns" >Untrusted patterns</a >.
54
54
</li >
55
55
</references >
56
56
</qhelp >
0 commit comments