Skip to content

Commit ccc1243

Browse files
committed
Rust: Add .qhelp and examples.
1 parent e708167 commit ccc1243

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE qhelp PUBLIC
2+
"-//Semmle//qhelp//EN"
3+
"qhelp.dtd">
4+
<qhelp>
5+
6+
<overview>
7+
<p>
8+
Sensitive user data and system information that is logged could be seen by an attacker when it is
9+
displayed. Also, external processes often store the standard output and standard error streams of
10+
an application, which will include logged sensitive information.</p>
11+
</p>
12+
</overview>
13+
14+
<recommendation>
15+
<p>
16+
Do not log sensitive data. If it is necessary to log sensitive data, encrypt it before logging.
17+
</p>
18+
</recommendation>
19+
20+
<example>
21+
<p>
22+
The following example code logs user credentials (in this case, their password) in plaintext:
23+
</p>
24+
<sample src="CleartextLoggingBad.rs"/>
25+
<p>
26+
Instead, you should encrypt the credentials, or better still omit them entirely:
27+
</p>
28+
<sample src="CleartextLoggingGood.rs"/>
29+
</example>
30+
31+
<references>
32+
33+
<li>M. Dowd, J. McDonald and J. Schuhm, <i>The Art of Software Security Assessment</i>, 1st Edition, Chapter 2 - 'Common Vulnerabilities of Encryption', p. 43. Addison Wesley, 2006.</li>
34+
<li>M. Howard and D. LeBlanc, <i>Writing Secure Code</i>, 2nd Edition, Chapter 9 - 'Protecting Secret Data', p. 299. Microsoft, 2002.</li>
35+
<li>OWASP: <a href="https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html#data-to-exclude">Logging Cheat Sheet - Data to exclude</a>.<li>
36+
37+
</references>
38+
</qhelp>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
let password = "P@ssw0rd"
2+
info!("User password changed to {password}")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
let password = "P@ssw0rd"
2+
info!("User password changed")

0 commit comments

Comments
 (0)