@@ -7,10 +7,12 @@ import semmle.code.java.frameworks.android.PendingIntent
7
7
import semmle.code.java.security.ImplicitPendingIntents
8
8
9
9
/**
10
+ * DEPRECATED: Use `ImplicitPendingIntentStartFlow` instead.
11
+ *
10
12
* A taint tracking configuration for implicit `PendingIntent`s
11
13
* being wrapped in another implicit `Intent` that gets started.
12
14
*/
13
- class ImplicitPendingIntentStartConf extends TaintTracking:: Configuration {
15
+ deprecated class ImplicitPendingIntentStartConf extends TaintTracking:: Configuration {
14
16
ImplicitPendingIntentStartConf ( ) { this = "ImplicitPendingIntentStartConf" }
15
17
16
18
override predicate isSource ( DataFlow:: Node source , DataFlow:: FlowState state ) {
@@ -52,3 +54,50 @@ class ImplicitPendingIntentStartConf extends TaintTracking::Configuration {
52
54
c instanceof DataFlow:: ArrayContent
53
55
}
54
56
}
57
+
58
+ /**
59
+ * A taint tracking configuration for implicit `PendingIntent`s
60
+ * being wrapped in another implicit `Intent` that gets started.
61
+ */
62
+ module ImplicitPendingIntentStartConfig implements DataFlow:: StateConfigSig {
63
+ class FlowState = DataFlow:: FlowState ;
64
+
65
+ predicate isSource ( DataFlow:: Node source , FlowState state ) {
66
+ source .( ImplicitPendingIntentSource ) .hasState ( state )
67
+ }
68
+
69
+ predicate isSink ( DataFlow:: Node sink , FlowState state ) {
70
+ sink .( ImplicitPendingIntentSink ) .hasState ( state )
71
+ }
72
+
73
+ predicate isBarrier ( DataFlow:: Node sanitizer ) { sanitizer instanceof ExplicitIntentSanitizer }
74
+
75
+ predicate isBarrier ( DataFlow:: Node node , FlowState state ) { none ( ) }
76
+
77
+ predicate isAdditionalFlowStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
78
+ any ( ImplicitPendingIntentAdditionalTaintStep c ) .step ( node1 , node2 )
79
+ }
80
+
81
+ predicate isAdditionalFlowStep (
82
+ DataFlow:: Node node1 , FlowState state1 , DataFlow:: Node node2 , FlowState state2
83
+ ) {
84
+ any ( ImplicitPendingIntentAdditionalTaintStep c ) .step ( node1 , state1 , node2 , state2 )
85
+ }
86
+
87
+ predicate allowImplicitRead ( DataFlow:: Node node , DataFlow:: ContentSet c ) {
88
+ isSink ( node , _) and
89
+ allowIntentExtrasImplicitRead ( node , c )
90
+ or
91
+ isAdditionalFlowStep ( node , _) and
92
+ c .( DataFlow:: FieldContent ) .getType ( ) instanceof PendingIntent
93
+ or
94
+ // Allow implicit reads of Intent arrays for steps like getActivities
95
+ // or sinks like startActivities
96
+ ( isSink ( node , _) or isAdditionalFlowStep ( node , _, _, _) ) and
97
+ node .getType ( ) .( Array ) .getElementType ( ) instanceof TypeIntent and
98
+ c instanceof DataFlow:: ArrayContent
99
+ }
100
+ }
101
+
102
+ module ImplicitPendingIntentStartFlow =
103
+ TaintTracking:: GlobalWithState< ImplicitPendingIntentStartConfig > ;
0 commit comments