Skip to content

Commit b48fd99

Browse files
committed
Rust: Applying suggestions to documentation
1 parent 5c83644 commit b48fd99

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

rust/ql/src/queries/security/CWE-020/RegexInjection.qhelp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<overview>
77
<p>
88
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
1111
counted repetitions.
1212
</p>
1313
</overview>
@@ -22,13 +22,13 @@ escape meta-characters that have special meaning.
2222
<p>
2323
If purposefully supporting user supplied regular expressions, then use <a
2424
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.
2626
</p>
2727
</recommendation>
2828

2929
<example>
3030
<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
3232
<code>key</code> without escaping it first.
3333
</p>
3434

@@ -41,16 +41,16 @@ malicious user might inject the regular expression <code>".*^|key"</code> and
4141
unexpectedly cause strings such as <code>"key=secret"</code> to match.
4242
</p>
4343
<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
4646
meanings in regular expressions.
4747
</p>
4848
<sample src="RegexInjectionGood.rs" />
4949
</example>
5050

5151
<references>
5252
<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>.
5454
</li>
5555
</references>
5656
</qhelp>

rust/ql/src/queries/security/CWE-020/RegexInjection.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/**
22
* @name Regular expression injection
3-
* @description
3+
* @description User input should not be used in regular expressions without first being
4+
* escaped, otherwise a malicious user may be able to inject an expression that
5+
* could modify the meaning of the expression, causing it to match unexpected
6+
* strings.
47
* @kind path-problem
58
* @problem.severity error
69
* @security-severity 7.8

0 commit comments

Comments
 (0)