Skip to content

Commit dc5eb40

Browse files
committed
Update JS CleartextLogging qhelp
1 parent d671cc6 commit dc5eb40

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

javascript/ql/src/Security/CWE-312/CleartextLogging.qhelp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,32 @@
22
"-//Semmle//qhelp//EN"
33
"qhelp.dtd">
44
<qhelp>
5-
<include src="CleartextStorage.qhelp" /></qhelp>
5+
6+
<overview>
7+
8+
<p>If sensitive data is written to a log entry it is exposed. Sensitive data should not be exposed.</p>
9+
10+
<p>Potential attackers can obtain sensitive user data when the log output is displayed. Additionally that data may
11+
expose system information such as full path names, system information, and sometimes usernames and passwords.</p>
12+
</overview>
13+
14+
<recommendation>
15+
<p>
16+
Sensitive data should not be logged.
17+
</p>
18+
</recommendation>
19+
20+
<example>
21+
<p>In the example the entire process environment is logged using `console.info`. Regular users of the production deployed application
22+
should not have access to this much information about the environment configuration.
23+
</p>
24+
<sample src="examples/CleartextLogging.js" />
25+
26+
<p> In the second example the data that is logged is not sensitive.</p>
27+
<sample src="examples/CleartextLoggingGood.js" />
28+
</example>
29+
30+
<references>
31+
<li>OWASP: <a href="https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/">Insertion of Sensitive Information into Log File</a>.</li>
32+
</references>
33+
</qhelp>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// BAD: Logging cleartext sensitive data
2+
console.info(`[INFO] Environment: ${process.env}`);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let not_sensitive_data = { a: 1, b : 2}
2+
// GOOD: it is fine to log data that is not sensitive
3+
console.info(`[INFO] Some object contains: ${not_sensitive_data}`);

0 commit comments

Comments
 (0)