Skip to content

Commit b7f7c5b

Browse files
committed
Change format of fluent models to make review easier
1 parent f63ffb0 commit b7f7c5b

File tree

3 files changed

+34
-72
lines changed

3 files changed

+34
-72
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ class SyntheticField extends string {
695695

696696
private predicate parseSynthField(string c, string f) {
697697
specSplit(_, c, _) and
698-
c.regexpCapture("SyntheticField\\[([.a-zA-Z0-9$]+)\\]", 1) = f
698+
c.regexpCapture("SyntheticField\\[([.a-zA-Z0-9]+)\\]", 1) = f
699699
}
700700

701701
/** Holds if the specification component parses as a `Content`. */
Lines changed: 31 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/** Provides classes and predicates related to Android notifications. */
2+
13
import java
24
private import semmle.code.java.dataflow.ExternalFlow
35

@@ -9,83 +11,43 @@ private class NotificationBuildersSummaryModels extends SummaryModelCsv {
911
"android.app;Notification$Action$Builder;true;Builder;(int,CharSequence,PendingIntent);;Argument[2];Argument[-1];taint",
1012
"android.app;Notification$Action$Builder;true;Builder;(Icon,CharSequence,PendingIntent);;Argument[2];Argument[-1];taint",
1113
"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",
14+
"android.app;Notification$Action$Builder;true;addExtras;;;MapKey of Argument[0];MapKey of SyntheticField[android.app.NotificationActionBuilder.extras] of Argument[-1];value",
15+
"android.app;Notification$Action$Builder;true;addExtras;;;MapValue of Argument[0];MapValue of SyntheticField[android.app.NotificationActionBuilder.extras] of Argument[-1];value",
1616
"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",
17+
"android.app;Notification$Action$Builder;true;getExtras;;;SyntheticField[android.app.NotificationActionBuilder.extras] of Argument[-1];ReturnValue;value",
2418
"android.app;Notification$Builder;true;addAction;(int,CharSequence,PendingIntent);;Argument[2];Argument[-1];taint",
2519
"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",
20+
"android.app;Notification$Builder;true;addExtras;;;MapKey of Argument[0];MapKey of SyntheticField[android.app.NotificationBuilder.extras] of Argument[-1];value",
21+
"android.app;Notification$Builder;true;addExtras;;;MapValue of Argument[0];MapValue of SyntheticField[android.app.NotificationBuilder.extras] of Argument[-1];value",
3022
"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",
23+
"android.app;Notification$Builder;true;setContentIntent;;;Argument[0];Argument[-1];taint",
24+
"android.app;Notification$Builder;true;getExtras;;;SyntheticField[android.app.NotificationBuilder.extras] of Argument[-1];ReturnValue;value",
3325
"android.app;Notification$Builder;true;recoverBuilder;;;Argument[1];ReturnValue;taint",
34-
"android.app;Notification$Builder;true;setActions;;;Argument[-1];ReturnValue;value",
3526
"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",
27+
"android.app;Notification$Builder;true;setExtras;;;Argument[0];SyntheticField[android.app.NotificationBuilder.extras] of Argument[-1];value",
5428
"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",
7329
"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"
30+
// Fluent models
31+
"android.app;Notification$Action$Builder;true;" +
32+
[
33+
"addExtras", "addRemoteInput", "extend", "setAllowGeneratedReplies",
34+
"setAuthenticationRequired", "setContextual", "setSemanticAction"
35+
] + ";;;Argument[-1];ReturnValue;value",
36+
"android.app;Notification$Builder;true;" +
37+
[
38+
"addAction", "addExtras", "addPerson", "extend", "setActions", "setAutoCancel",
39+
"setBadgeIconType", "setBubbleMetadata", "setCategory", "setChannelId",
40+
"setChronometerCountDown", "setColor", "setColorized", "setContent", "setContentInfo",
41+
"setContentIntent", "setContentText", "setContentTitle", "setCustomBigContentView",
42+
"setCustomHeadsUpContentView", "setDefaults", "setDeleteIntent", "setExtras", "setFlag",
43+
"setForegroundServiceBehavior", "setFullScreenIntent", "setGroup",
44+
"setGroupAlertBehavior", "setGroupSummary", "setLargeIcon", "setLights", "setLocalOnly",
45+
"setLocusId", "setNumber", "setOngoing", "setOnlyAlertOnce", "setPriority",
46+
"setProgress", "setPublicVersion", "setRemoteInputHistory", "setSettingsText",
47+
"setShortcutId", "setShowWhen", "setSmallIcon", "setSortKey", "setSound", "setStyle",
48+
"setSubText", "setTicker", "setTimeoutAfter", "setUsesChronometer", "setVibrate",
49+
"setVisibility", "setWhen"
50+
] + ";;;Argument[-1];ReturnValue;value"
8951
]
9052
}
9153
}

java/ql/test/library-tests/frameworks/android/notification/test.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ class SummaryModelTest extends SummaryModelCsv {
77
[
88
//"package;type;overrides;name;signature;ext;inputspec;outputspec;kind",
99
"generatedtest;Test;false;getMapKeyDefault;(Bundle);;MapKey of Argument[0];ReturnValue;value",
10-
"generatedtest;Test;false;newActionBuilderWithExtras;(Bundle);;Argument[0];SyntheticField[android.app.Notification$Action$Builder.extras] of ReturnValue;value",
11-
"generatedtest;Test;false;newBuilderWithExtras;(Bundle);;Argument[0];SyntheticField[android.app.Notification$Builder.extras] of ReturnValue;value"
10+
"generatedtest;Test;false;newActionBuilderWithExtras;(Bundle);;Argument[0];SyntheticField[android.app.NotificationActionBuilder.extras] of ReturnValue;value",
11+
"generatedtest;Test;false;newBuilderWithExtras;(Bundle);;Argument[0];SyntheticField[android.app.NotificationBuilder.extras] of ReturnValue;value"
1212
]
1313
}
1414
}

0 commit comments

Comments
 (0)