Skip to content

Commit 8bba3eb

Browse files
authored
Merge pull request github#6823 from atorralba/atorralba/android-notification-models
Android: Add models for `android.app.Notification` builders
2 parents 8e11c2c + 38250b0 commit 8bba3eb

File tree

16 files changed

+3252
-12
lines changed

16 files changed

+3252
-12
lines changed

java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ private module Frameworks {
7979
private import internal.ContainerFlow
8080
private import semmle.code.java.frameworks.android.Android
8181
private import semmle.code.java.frameworks.android.Intent
82+
private import semmle.code.java.frameworks.android.Notifications
8283
private import semmle.code.java.frameworks.android.Slice
8384
private import semmle.code.java.frameworks.android.SQLite
8485
private import semmle.code.java.frameworks.android.XssSinks
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/** Provides classes and predicates related to Android notifications. */
2+
3+
import java
4+
private import semmle.code.java.dataflow.DataFlow
5+
private import semmle.code.java.dataflow.ExternalFlow
6+
private import semmle.code.java.dataflow.FlowSteps
7+
8+
private class NotificationBuildersSummaryModels extends SummaryModelCsv {
9+
override predicate row(string row) {
10+
row =
11+
[
12+
"android.app;Notification$Action;true;Action;(int,CharSequence,PendingIntent);;Argument[2];Argument[-1];taint",
13+
"android.app;Notification$Action;true;getExtras;;;SyntheticField[android.content.Intent.extras] of Argument[-1];ReturnValue;value",
14+
"android.app;Notification$Action$Builder;true;Builder;(int,CharSequence,PendingIntent);;Argument[2];Argument[-1];taint",
15+
"android.app;Notification$Action$Builder;true;Builder;(Icon,CharSequence,PendingIntent);;Argument[2];Argument[-1];taint",
16+
"android.app;Notification$Action$Builder;true;Builder;(Action);;Argument[0];Argument[-1];taint",
17+
"android.app;Notification$Action$Builder;true;addExtras;;;MapKey of Argument[0];MapKey of SyntheticField[android.content.Intent.extras] of Argument[-1];value",
18+
"android.app;Notification$Action$Builder;true;addExtras;;;MapValue of Argument[0];MapValue of SyntheticField[android.content.Intent.extras] of Argument[-1];value",
19+
"android.app;Notification$Action$Builder;true;build;;;Argument[-1];ReturnValue;taint",
20+
"android.app;Notification$Action$Builder;true;build;;;SyntheticField[android.content.Intent.extras] of Argument[-1];SyntheticField[android.content.Intent.extras] of ReturnValue;value",
21+
"android.app;Notification$Action$Builder;true;getExtras;;;SyntheticField[android.content.Intent.extras] of Argument[-1];ReturnValue;value",
22+
"android.app;Notification$Builder;true;addAction;(int,CharSequence,PendingIntent);;Argument[2];Argument[-1];taint",
23+
"android.app;Notification$Builder;true;addAction;(Action);;Argument[0];Argument[-1];taint",
24+
"android.app;Notification$Builder;true;addExtras;;;MapKey of Argument[0];MapKey of SyntheticField[android.content.Intent.extras] of Argument[-1];value",
25+
"android.app;Notification$Builder;true;addExtras;;;MapValue of Argument[0];MapValue of SyntheticField[android.content.Intent.extras] of Argument[-1];value",
26+
"android.app;Notification$Builder;true;build;;;Argument[-1];ReturnValue;taint",
27+
"android.app;Notification$Builder;true;build;;;SyntheticField[android.content.Intent.extras] of Argument[-1];Field[android.app.Notification.extras] of ReturnValue;value",
28+
"android.app;Notification$Builder;true;setContentIntent;;;Argument[0];Argument[-1];taint",
29+
"android.app;Notification$Builder;true;getExtras;;;SyntheticField[android.content.Intent.extras] of Argument[-1];ReturnValue;value",
30+
"android.app;Notification$Builder;true;recoverBuilder;;;Argument[1];ReturnValue;taint",
31+
"android.app;Notification$Builder;true;setActions;;;ArrayElement of Argument[0];Argument[-1];taint",
32+
"android.app;Notification$Builder;true;setExtras;;;Argument[0];SyntheticField[android.content.Intent.extras] of Argument[-1];value",
33+
"android.app;Notification$Builder;true;setDeleteIntent;;;Argument[0];Argument[-1];taint",
34+
"android.app;Notification$Builder;true;setPublicVersion;;;Argument[0];Argument[-1];taint",
35+
// Fluent models
36+
"android.app;Notification$Action$Builder;true;" +
37+
[
38+
"addExtras", "addRemoteInput", "extend", "setAllowGeneratedReplies",
39+
"setAuthenticationRequired", "setContextual", "setSemanticAction"
40+
] + ";;;Argument[-1];ReturnValue;value",
41+
"android.app;Notification$Builder;true;" +
42+
[
43+
"addAction", "addExtras", "addPerson", "extend", "setActions", "setAutoCancel",
44+
"setBadgeIconType", "setBubbleMetadata", "setCategory", "setChannelId",
45+
"setChronometerCountDown", "setColor", "setColorized", "setContent", "setContentInfo",
46+
"setContentIntent", "setContentText", "setContentTitle", "setCustomBigContentView",
47+
"setCustomHeadsUpContentView", "setDefaults", "setDeleteIntent", "setExtras", "setFlag",
48+
"setForegroundServiceBehavior", "setFullScreenIntent", "setGroup",
49+
"setGroupAlertBehavior", "setGroupSummary", "setLargeIcon", "setLights", "setLocalOnly",
50+
"setLocusId", "setNumber", "setOngoing", "setOnlyAlertOnce", "setPriority",
51+
"setProgress", "setPublicVersion", "setRemoteInputHistory", "setSettingsText",
52+
"setShortcutId", "setShowWhen", "setSmallIcon", "setSortKey", "setSound", "setStyle",
53+
"setSubText", "setTicker", "setTimeoutAfter", "setUsesChronometer", "setVibrate",
54+
"setVisibility", "setWhen"
55+
] + ";;;Argument[-1];ReturnValue;value"
56+
]
57+
}
58+
}

0 commit comments

Comments
 (0)