Skip to content

Commit f63ffb0

Browse files
committed
Add models for Notification builders
1 parent b49ca6a commit f63ffb0

File tree

16 files changed

+3269
-13
lines changed

16 files changed

+3269
-13
lines changed

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

Lines changed: 2 additions & 1 deletion
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
@@ -694,7 +695,7 @@ class SyntheticField extends string {
694695

695696
private predicate parseSynthField(string c, string f) {
696697
specSplit(_, c, _) and
697-
c.regexpCapture("SyntheticField\\[([.a-zA-Z0-9]+)\\]", 1) = f
698+
c.regexpCapture("SyntheticField\\[([.a-zA-Z0-9$]+)\\]", 1) = f
698699
}
699700

700701
/** Holds if the specification component parses as a `Content`. */
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import java
2+
private import semmle.code.java.dataflow.ExternalFlow
3+
4+
private class NotificationBuildersSummaryModels extends SummaryModelCsv {
5+
override predicate row(string row) {
6+
row =
7+
[
8+
"android.app;Notification$Action;true;Action;(int,CharSequence,PendingIntent);;Argument[2];Argument[-1];taint",
9+
"android.app;Notification$Action$Builder;true;Builder;(int,CharSequence,PendingIntent);;Argument[2];Argument[-1];taint",
10+
"android.app;Notification$Action$Builder;true;Builder;(Icon,CharSequence,PendingIntent);;Argument[2];Argument[-1];taint",
11+
"android.app;Notification$Action$Builder;true;Builder;(Action);;Argument[0];Argument[-1];taint",
12+
"android.app;Notification$Action$Builder;true;addExtras;;;Argument[-1];ReturnValue;value",
13+
"android.app;Notification$Action$Builder;true;addExtras;;;MapKey of Argument[0];MapKey of SyntheticField[android.app.Notification$Action$Builder.extras] of Argument[-1];value",
14+
"android.app;Notification$Action$Builder;true;addExtras;;;MapValue of Argument[0];MapValue of SyntheticField[android.app.Notification$Action$Builder.extras] of Argument[-1];value",
15+
"android.app;Notification$Action$Builder;true;addRemoteInput;;;Argument[-1];ReturnValue;value",
16+
"android.app;Notification$Action$Builder;true;build;;;Argument[-1];ReturnValue;taint",
17+
"android.app;Notification$Action$Builder;true;extend;;;Argument[-1];ReturnValue;value",
18+
"android.app;Notification$Action$Builder;true;getExtras;;;SyntheticField[android.app.Notification$Action$Builder.extras] of Argument[-1];ReturnValue;value",
19+
"android.app;Notification$Action$Builder;true;setAllowGeneratedReplies;;;Argument[-1];ReturnValue;value",
20+
"android.app;Notification$Action$Builder;true;setAuthenticationRequired;;;Argument[-1];ReturnValue;value",
21+
"android.app;Notification$Action$Builder;true;setContextual;;;Argument[-1];ReturnValue;value",
22+
"android.app;Notification$Action$Builder;true;setSemanticAction;;;Argument[-1];ReturnValue;value",
23+
"android.app;Notification$Builder;true;addAction;;;Argument[-1];ReturnValue;value",
24+
"android.app;Notification$Builder;true;addAction;(int,CharSequence,PendingIntent);;Argument[2];Argument[-1];taint",
25+
"android.app;Notification$Builder;true;addAction;(Action);;Argument[0];Argument[-1];taint",
26+
"android.app;Notification$Builder;true;addExtras;;;Argument[-1];ReturnValue;value",
27+
"android.app;Notification$Builder;true;addExtras;;;MapKey of Argument[0];MapKey of SyntheticField[android.app.Notification$Builder.extras] of Argument[-1];value",
28+
"android.app;Notification$Builder;true;addExtras;;;MapValue of Argument[0];MapValue of SyntheticField[android.app.Notification$Builder.extras] of Argument[-1];value",
29+
"android.app;Notification$Builder;true;addPerson;;;Argument[-1];ReturnValue;value",
30+
"android.app;Notification$Builder;true;build;;;Argument[-1];ReturnValue;taint",
31+
"android.app;Notification$Builder;true;extend;;;Argument[-1];ReturnValue;value",
32+
"android.app;Notification$Builder;true;getExtras;;;SyntheticField[android.app.Notification$Builder.extras] of Argument[-1];ReturnValue;value",
33+
"android.app;Notification$Builder;true;recoverBuilder;;;Argument[1];ReturnValue;taint",
34+
"android.app;Notification$Builder;true;setActions;;;Argument[-1];ReturnValue;value",
35+
"android.app;Notification$Builder;true;setActions;;;ArrayElement of Argument[0];Argument[-1];taint",
36+
"android.app;Notification$Builder;true;setAutoCancel;;;Argument[-1];ReturnValue;value",
37+
"android.app;Notification$Builder;true;setBadgeIconType;;;Argument[-1];ReturnValue;value",
38+
"android.app;Notification$Builder;true;setBubbleMetadata;;;Argument[-1];ReturnValue;value",
39+
"android.app;Notification$Builder;true;setCategory;;;Argument[-1];ReturnValue;value",
40+
"android.app;Notification$Builder;true;setChannelId;;;Argument[-1];ReturnValue;value",
41+
"android.app;Notification$Builder;true;setChronometerCountDown;;;Argument[-1];ReturnValue;value",
42+
"android.app;Notification$Builder;true;setColor;;;Argument[-1];ReturnValue;value",
43+
"android.app;Notification$Builder;true;setColorized;;;Argument[-1];ReturnValue;value",
44+
"android.app;Notification$Builder;true;setContent;;;Argument[-1];ReturnValue;value",
45+
"android.app;Notification$Builder;true;setContentInfo;;;Argument[-1];ReturnValue;value",
46+
"android.app;Notification$Builder;true;setContentIntent;;;Argument[-1];ReturnValue;value",
47+
"android.app;Notification$Builder;true;setContentIntent;;;Argument[0];Argument[-1];taint",
48+
"android.app;Notification$Builder;true;setContentText;;;Argument[-1];ReturnValue;value",
49+
"android.app;Notification$Builder;true;setContentTitle;;;Argument[-1];ReturnValue;value",
50+
"android.app;Notification$Builder;true;setCustomBigContentView;;;Argument[-1];ReturnValue;value",
51+
"android.app;Notification$Builder;true;setCustomHeadsUpContentView;;;Argument[-1];ReturnValue;value",
52+
"android.app;Notification$Builder;true;setDefaults;;;Argument[-1];ReturnValue;value",
53+
"android.app;Notification$Builder;true;setDeleteIntent;;;Argument[-1];ReturnValue;value",
54+
"android.app;Notification$Builder;true;setDeleteIntent;;;Argument[0];Argument[-1];taint",
55+
"android.app;Notification$Builder;true;setExtras;;;Argument[-1];ReturnValue;value",
56+
"android.app;Notification$Builder;true;setExtras;;;Argument[0];SyntheticField[android.app.Notification$Builder.extras] of Argument[-1];value",
57+
"android.app;Notification$Builder;true;setFlag;;;Argument[-1];ReturnValue;value",
58+
"android.app;Notification$Builder;true;setForegroundServiceBehavior;;;Argument[-1];ReturnValue;value",
59+
"android.app;Notification$Builder;true;setFullScreenIntent;;;Argument[-1];ReturnValue;value",
60+
"android.app;Notification$Builder;true;setGroup;;;Argument[-1];ReturnValue;value",
61+
"android.app;Notification$Builder;true;setGroupAlertBehavior;;;Argument[-1];ReturnValue;value",
62+
"android.app;Notification$Builder;true;setGroupSummary;;;Argument[-1];ReturnValue;value",
63+
"android.app;Notification$Builder;true;setLargeIcon;;;Argument[-1];ReturnValue;value",
64+
"android.app;Notification$Builder;true;setLights;;;Argument[-1];ReturnValue;value",
65+
"android.app;Notification$Builder;true;setLocalOnly;;;Argument[-1];ReturnValue;value",
66+
"android.app;Notification$Builder;true;setLocusId;;;Argument[-1];ReturnValue;value",
67+
"android.app;Notification$Builder;true;setNumber;;;Argument[-1];ReturnValue;value",
68+
"android.app;Notification$Builder;true;setOngoing;;;Argument[-1];ReturnValue;value",
69+
"android.app;Notification$Builder;true;setOnlyAlertOnce;;;Argument[-1];ReturnValue;value",
70+
"android.app;Notification$Builder;true;setPriority;;;Argument[-1];ReturnValue;value",
71+
"android.app;Notification$Builder;true;setProgress;;;Argument[-1];ReturnValue;value",
72+
"android.app;Notification$Builder;true;setPublicVersion;;;Argument[-1];ReturnValue;value",
73+
"android.app;Notification$Builder;true;setPublicVersion;;;Argument[0];Argument[-1];taint",
74+
"android.app;Notification$Builder;true;setRemoteInputHistory;;;Argument[-1];ReturnValue;value",
75+
"android.app;Notification$Builder;true;setSettingsText;;;Argument[-1];ReturnValue;value",
76+
"android.app;Notification$Builder;true;setShortcutId;;;Argument[-1];ReturnValue;value",
77+
"android.app;Notification$Builder;true;setShowWhen;;;Argument[-1];ReturnValue;value",
78+
"android.app;Notification$Builder;true;setSmallIcon;;;Argument[-1];ReturnValue;value",
79+
"android.app;Notification$Builder;true;setSortKey;;;Argument[-1];ReturnValue;value",
80+
"android.app;Notification$Builder;true;setSound;;;Argument[-1];ReturnValue;value",
81+
"android.app;Notification$Builder;true;setStyle;;;Argument[-1];ReturnValue;value",
82+
"android.app;Notification$Builder;true;setSubText;;;Argument[-1];ReturnValue;value",
83+
"android.app;Notification$Builder;true;setTicker;;;Argument[-1];ReturnValue;value",
84+
"android.app;Notification$Builder;true;setTimeoutAfter;;;Argument[-1];ReturnValue;value",
85+
"android.app;Notification$Builder;true;setUsesChronometer;;;Argument[-1];ReturnValue;value",
86+
"android.app;Notification$Builder;true;setVibrate;;;Argument[-1];ReturnValue;value",
87+
"android.app;Notification$Builder;true;setVisibility;;;Argument[-1];ReturnValue;value",
88+
"android.app;Notification$Builder;true;setWhen;;;Argument[-1];ReturnValue;value"
89+
]
90+
}
91+
}

0 commit comments

Comments
 (0)