Skip to content

Commit bea4162

Browse files
committed
delete multi-char note from the incomplete-sanitization qhelp
1 parent a60478b commit bea4162

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,6 @@ needed, for instance by using prepared statements for SQL queries.
4343
Otherwise, make sure to use a regular expression with the <code>g</code> flag to ensure that
4444
all occurrences are replaced, and remember to escape backslashes if applicable.
4545
</p>
46-
<p>
47-
Note, however, that this is generally <i>not</i> sufficient for replacing multi-character strings:
48-
the <code>String.prototype.replace</code> method only performs one pass over the input string,
49-
and will not replace further instances of the string that result from earlier replacements.
50-
</p>
51-
<p>
52-
For example, consider the code snippet <code>s.replace(/\/\.\.\//g, "")</code>, which attempts
53-
to strip out all occurences of <code>/../</code> from <code>s</code>. This will not work as
54-
expected: for the string <code>/./.././</code>, for example, it will remove the single
55-
occurrence of <code>/../</code> in the middle, but the remainder of the string then becomes
56-
<code>/../</code>, which is another instance of the substring we were trying to remove.
57-
</p>
5846
</recommendation>
5947

6048
<example>

ruby/ql/src/queries/security/cwe-116/IncompleteSanitization.qhelp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ An even safer alternative is to design the application so that sanitization is n
3737
Otherwise, make sure to use <code>String#gsub</code> rather than <code>String#sub</code>, to ensure
3838
that all occurrences are replaced, and remember to escape backslashes if applicable.
3939
</p>
40-
<p>
41-
Note, however, that this is generally <i>not</i> sufficient for replacing multi-character strings:
42-
the <code>String#gsub</code> method performs only one pass over the input string, and will not
43-
replace further instances of the string that result from earlier replacements.
44-
</p>
45-
<p>
46-
For example, consider the code snippet <code>s.gsub /\/\.\.\//, ""</code>, which attempts to strip
47-
out all occurrences of <code>/../</code> from <code>s</code>. This will not work as expected: for the
48-
string <code>/./.././</code>, for example, it will remove the single occurrence of <code>/../</code>
49-
in the middle, but the remainder of the string then becomes <code>/../</code>, which is another
50-
instance of the substring we were trying to remove.
51-
</p>
5240
</recommendation>
5341

5442
<example>

0 commit comments

Comments
 (0)