mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Update JS CleartextLogging qhelp
This commit is contained in:
@@ -2,4 +2,32 @@
|
||||
"-//Semmle//qhelp//EN"
|
||||
"qhelp.dtd">
|
||||
<qhelp>
|
||||
<include src="CleartextStorage.qhelp" /></qhelp>
|
||||
|
||||
<overview>
|
||||
|
||||
<p>If sensitive data is written to a log entry it is exposed. Sensitive data should not be exposed.</p>
|
||||
|
||||
<p>Potential attackers can obtain sensitive user data when the log output is displayed. Additionally that data may
|
||||
expose system information such as full path names, system information, and sometimes usernames and passwords.</p>
|
||||
</overview>
|
||||
|
||||
<recommendation>
|
||||
<p>
|
||||
Sensitive data should not be logged.
|
||||
</p>
|
||||
</recommendation>
|
||||
|
||||
<example>
|
||||
<p>In the example the entire process environment is logged using `console.info`. Regular users of the production deployed application
|
||||
should not have access to this much information about the environment configuration.
|
||||
</p>
|
||||
<sample src="examples/CleartextLogging.js" />
|
||||
|
||||
<p> In the second example the data that is logged is not sensitive.</p>
|
||||
<sample src="examples/CleartextLoggingGood.js" />
|
||||
</example>
|
||||
|
||||
<references>
|
||||
<li>OWASP: <a href="https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/">Insertion of Sensitive Information into Log File</a>.</li>
|
||||
</references>
|
||||
</qhelp>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// BAD: Logging cleartext sensitive data
|
||||
console.info(`[INFO] Environment: ${process.env}`);
|
||||
@@ -0,0 +1,3 @@
|
||||
let not_sensitive_data = { a: 1, b : 2}
|
||||
// GOOD: it is fine to log data that is not sensitive
|
||||
console.info(`[INFO] Some object contains: ${not_sensitive_data}`);
|
||||
Reference in New Issue
Block a user