Skip to content

Commit ecea392

Browse files
committed
python: rewrite qhelp overview
(combining the Java version and the JS version)
1 parent 26befeb commit ecea392

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

python/ql/src/Security/CWE-117/LogInjection.qhelp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88

99
<p>If unsanitized user input is written to a log entry, a malicious user may be able to forge new log entries.</p>
1010

11-
<p>Forgery can occur if a user provides some input creating the appearance of multiple
12-
log entries. This can include unescaped new-line characters, or HTML or other markup.</p>
11+
<p>Forgery can occur if a user provides some input with characters that are interpreted
12+
when the log output is displayed. If the log is displayed as a plain text file, then new
13+
line characters can be used by a malicious user to create the appearance of multiple log
14+
entries. If the log is displayed as HTML, then arbitrary HTML may be included to spoof
15+
log entries.</p>
1316
</overview>
1417

1518
<recommendation>
@@ -29,14 +32,14 @@ other forms of HTML injection.
2932

3033
<example>
3134
<p>
32-
In the example, the name provided by the user is recorded using the log output function (<code>logging.info</code> or <code>app.logger.info</code>, etc.).
33-
In these four cases, the name provided by the user is not provided The processing is recorded. If a malicious user provides <code>Guest%0D%0AUser name: Admin</code>
35+
In the example, the name provided by the user is recorded using the log output function (<code>logging.info</code> or <code>app.logger.info</code>, etc.).
36+
In these four cases, the name provided by the user is not provided The processing is recorded. If a malicious user provides <code>Guest%0D%0AUser name: Admin</code>
3437
as a parameter, the log entry will be divided into two lines, the first line is <code>User name: Guest</code> code>, the second line is <code>User name: Admin</code>.
3538
</p>
3639
<sample src="LogInjectionBad.py" />
3740

3841
<p>
39-
In a good example, the program uses the <code>replace</code> function to provide parameter processing to the user, and replace <code>\r\n</code> and <code>\n</code>
42+
In a good example, the program uses the <code>replace</code> function to provide parameter processing to the user, and replace <code>\r\n</code> and <code>\n</code>
4043
with empty characters. To a certain extent, the occurrence of log injection vulnerabilities is reduced.
4144
</p>
4245

0 commit comments

Comments
 (0)