Skip to content

Commit 1190352

Browse files
Add qhelp
1 parent d806fca commit 1190352

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// BAD: `password` is exposed in a notification.
2+
void confirmPassword(String password) {
3+
NotificationManager manager = NotificationManager.from(this);
4+
manager.send(
5+
new Notification.Builder(this, CHANNEL_ID)
6+
.setContentText("Your password is: " + password)
7+
.build());
8+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE qhelp PUBLIC
2+
"-//Semmle//qhelp//EN"
3+
"qhelp.dtd">
4+
<qhelp>
5+
<overview>
6+
<p>
7+
Sensitive information such as passwords or two-factor authentication (2FA) codes should not be exposed in a system notification.
8+
Notifications should not be considered secure, as other untrusted applications may be able to use a
9+
<code>NotificationListenerService</code> to read the contents of notifications.
10+
</p>
11+
</overview>
12+
13+
<recommendation>
14+
<p>
15+
Do not expose sensitive data in notifications.
16+
</p>
17+
</recommendation>
18+
19+
<example>
20+
<p>
21+
In the following sample, the <code>password</code> is sent as part of a notification.
22+
This can allow another application to read this password.
23+
</p>
24+
25+
<sample src="AndroidSensitiveNotifications.java"/>
26+
</example>
27+
28+
<references>
29+
<li>
30+
OWASP Mobile Application Security: <a href="https://mas.owasp.org/MASTG/Android/0x05d-Testing-Data-Storage/#app-notifications">Android Data Storage - Application Notifications</a>
31+
</li>
32+
</references>
33+
34+
</qhelp>

0 commit comments

Comments
 (0)