Skip to content

Commit a1a2acd

Browse files
Add additional test cases
1 parent f9bb004 commit a1a2acd

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

java/ql/lib/semmle/code/java/security/SensitiveUiQuery.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ private module NotificationTrackingConfig implements DataFlow::ConfigSig {
1010
predicate isSource(DataFlow::Node src) { src.asExpr() instanceof SensitiveExpr }
1111

1212
predicate isSink(DataFlow::Node sink) { sinkNode(sink, "notification") }
13+
14+
predicate allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet c) {
15+
isSink(node) and exists(c)
16+
}
1317
}
1418

1519
/** Taint tracking flow for sensitive data flowing to system notifications. */

java/ql/test/query-tests/security/CWE-200/semmle/tests/SensitiveNotification/Test.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import android.app.Activity;
22
import android.app.Notification;
33
import androidx.core.app.NotificationCompat;
4+
import android.content.Intent;
5+
import android.app.PendingIntent;
46

57
class Test extends Activity {
68
void test(String password) {
@@ -12,5 +14,17 @@ void test(String password) {
1214
void test2(String password) {
1315
Notification.Builder builder = new Notification.Builder(this, "");
1416
builder.setContentText(password); // $sensitive-notification
17+
builder.setContentTitle(password); // $sensitive-notification
18+
builder.addAction(0, password, null); // $sensitive-notification
19+
builder.addAction(new Notification.Action(0, password, null)); // $sensitive-notification
20+
// builder.setStyle( // TODO: update stubs to include MessagingStyle
21+
// new Notification.MessagingStyle(password) // $sensitive-notification
22+
// .setConversationTitle(password)) // $sensitive-notification
23+
// .addMessage(password, 0, null); // $sensitive-notification
24+
builder.setStyle(new Notification.BigTextStyle().bigText(password)); // $sensitive-notification
25+
Intent intent = new Intent();
26+
intent.putExtra("a", password);
27+
builder.setContentIntent(PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE)); // $MISSING: sensitive-notification // missing model for getActivity
28+
1529
}
1630
}

0 commit comments

Comments
 (0)