You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sensitive information that is logged unencrypted is accessible to an attacker
9
+
who gains access to the logs.
10
+
</p>
11
+
</overview>
12
+
13
+
<recommendation>
14
+
<p>
15
+
Ensure that sensitive information is always encrypted or obfuscated before being
16
+
logged.
17
+
</p>
18
+
19
+
<p>
20
+
In general, decrypt sensitive information only at the point where it is
21
+
necessary for it to be used in cleartext.
22
+
</p>
23
+
24
+
<p>
25
+
Be aware that external processes often store the standard out and
26
+
standard error streams of the application, causing logged sensitive
27
+
information to be stored.
28
+
</p>
29
+
</recommendation>
30
+
31
+
<example>
32
+
<p>
33
+
The following example code logs user credentials (in this case, their password)
34
+
in plain text:
35
+
</p>
36
+
<samplesrc="CleartextLoggingBad.swift"/>
37
+
<p>
38
+
Instead, the credentials should be encrypted, obfuscated, or omitted entirely:
39
+
</p>
40
+
<samplesrc="CleartextLoggingGood.swift"/>
41
+
</example>
42
+
43
+
<references>
44
+
45
+
<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>
46
+
<li>M. Howard and D. LeBlanc, <i>Writing Secure Code</i>, 2nd Edition, Chapter 9 - 'Protecting Secret Data', p. 299. Microsoft, 2002.</li>
0 commit comments