Skip to content

Commit 44d00a0

Browse files
committed
unified: Copy query help from old swift
1 parent dddc4db commit 44d00a0

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!DOCTYPE qhelp PUBLIC
2+
"-//Semmle//qhelp//EN"
3+
"qhelp.dtd">
4+
<qhelp>
5+
6+
<overview>
7+
<p>
8+
Attackers could gain access to sensitive information that is logged unencrypted.
9+
</p>
10+
</overview>
11+
12+
<recommendation>
13+
<p>
14+
Always make sure to encrypt or obfuscate sensitive information before you log it.
15+
</p>
16+
17+
<p>
18+
Generally, you should decrypt sensitive information only at the point where it is necessary for it to be used in cleartext.
19+
</p>
20+
21+
<p>
22+
Be aware that external processes often store the standard output and
23+
standard error streams of the application. This will include logged sensitive information.
24+
</p>
25+
</recommendation>
26+
27+
<example>
28+
<p>
29+
The following example code logs user credentials (in this case, their password)
30+
in plaintext:
31+
</p>
32+
<sample src="CleartextLoggingBad.swift"/>
33+
<p>
34+
Instead, you should encrypt or obfuscate the credentials, or omit them entirely:
35+
</p>
36+
<sample src="CleartextLoggingGood.swift"/>
37+
</example>
38+
39+
<references>
40+
41+
<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>
42+
<li>M. Howard and D. LeBlanc, <i>Writing Secure Code</i>, 2nd Edition, Chapter 9 - 'Protecting Secret Data', p. 299. Microsoft, 2002.</li>
43+
<li>OWASP: <a href="https://www.owasp.org/index.php/Password_Plaintext_Storage">Password Plaintext Storage</a>.</li>
44+
45+
</references>
46+
</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+
NSLog("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+
NSLog("User password changed")

0 commit comments

Comments
 (0)