Skip to content

Commit 8d6cac7

Browse files
committed
apply suggestions from asgerf
1 parent aafae24 commit 8d6cac7

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

javascript/ql/lib/semmle/javascript/security/BadTagFilterQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private module RegexpMatching {
153153
private State getAStateThatReachesAccept(
154154
MatchedRegExp reg, int i, string str, boolean ignorePrefix
155155
) {
156-
// base base, reaches an accepting state from the last state in `getAState(..)`
156+
// base case, reaches an accepting state from the last state in `getAState(..)`
157157
reg.testWithGroups(str, ignorePrefix) and
158158
i = str.length() - 1 and
159159
result = getAState(reg, i, str, ignorePrefix) and

javascript/ql/src/Security/CWE-116/BadTagFilter.qhelp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<overview>
77
<p>
88
It is possible to match some single HTML tags using regular expressions (parsing general HTML using
9-
regular expressions is impossible). However, if the regexp is not written well it might be easy
10-
to circumvent the regexp, which can lead to XSS or other security issues.
9+
regular expressions is impossible). However, if the regular expression is not written well it might
10+
be possible to circumvent it, which can lead to cross-site scripting or other security issues.
1111
</p>
1212
<p>
13-
Many of these mistakes are caused by browsers having very forgiving HTML parsers:
14-
Browsers will often render invalid HTML with parser errors.
15-
Regular expressions that attempt to match HTML must recognize tags containing these parser errors.
13+
Some of these mistakes are caused by browsers having very forgiving HTML parsers, and
14+
will often render invalid HTML containing syntax errors.
15+
Regular expressions that attempt to match HTML should also recognize tags containing such syntax errors.
1616
</p>
1717
</overview>
1818

@@ -34,7 +34,7 @@ The following example attempts to filters out all <code>&lt;script&gt;</code> ta
3434
The above sanitizer does not filter out all <code>&lt;script&gt;</code> tags.
3535
Browsers will not only accept <code>&lt;/script&gt;</code> as script end tags, but also tags such as <code>&lt;/script foo="bar"&gt;</code> even though it is a parser error.
3636
This means that an attack string such as <code>&lt;script&gt;alert(1)&lt;/script foo="bar"&gt;</code> will not be filtered by
37-
the function, but <code>alert(1)</code> will be executed by a browser if the string is rendered as HTML.
37+
the function, and <code>alert(1)</code> will be executed by a browser if the string is rendered as HTML.
3838
</p>
3939

4040
<p>

python/ql/lib/semmle/python/security/BadTagFilterQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private module RegexpMatching {
153153
private State getAStateThatReachesAccept(
154154
MatchedRegExp reg, int i, string str, boolean ignorePrefix
155155
) {
156-
// base base, reaches an accepting state from the last state in `getAState(..)`
156+
// base case, reaches an accepting state from the last state in `getAState(..)`
157157
reg.testWithGroups(str, ignorePrefix) and
158158
i = str.length() - 1 and
159159
result = getAState(reg, i, str, ignorePrefix) and

python/ql/src/Security/CWE-116/BadTagFilter.qhelp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<overview>
77
<p>
88
It is possible to match some single HTML tags using regular expressions (parsing general HTML using
9-
regular expressions is impossible). However, if the regexp is not written well it might be easy
10-
to circumvent the regexp, which can lead to XSS or other security issues.
9+
regular expressions is impossible). However, if the regular expression is not written well it might
10+
be possible to circumvent it, which can lead to cross-site scripting or other security issues.
1111
</p>
1212
<p>
13-
Many of these mistakes are caused by browsers having very forgiving HTML parsers:
14-
Browsers will often render invalid HTML with parser errors.
15-
Regular expressions that attempt to match HTML must recognize tags containing these parser errors.
13+
Some of these mistakes are caused by browsers having very forgiving HTML parsers, and
14+
will often render invalid HTML containing syntax errors.
15+
Regular expressions that attempt to match HTML should also recognize tags containing such syntax errors.
1616
</p>
1717
</overview>
1818

@@ -34,7 +34,7 @@ The following example attempts to filters out all <code>&lt;script&gt;</code> ta
3434
The above sanitizer does not filter out all <code>&lt;script&gt;</code> tags.
3535
Browsers will not only accept <code>&lt;/script&gt;</code> as script end tags, but also tags such as <code>&lt;/script foo="bar"&gt;</code> even though it is a parser error.
3636
This means that an attack string such as <code>&lt;script&gt;alert(1)&lt;/script foo="bar"&gt;</code> will not be filtered by
37-
the function, but <code>alert(1)</code> will be executed by a browser if the string is rendered as HTML.
37+
the function, and <code>alert(1)</code> will be executed by a browser if the string is rendered as HTML.
3838
</p>
3939

4040
<p>

0 commit comments

Comments
 (0)