@@ -7,10 +7,12 @@ import semmle.code.java.frameworks.android.PendingIntent
77import semmle.code.java.security.ImplicitPendingIntents
88
99/**
10+ * DEPRECATED: Use `ImplicitPendingIntentStartFlow` instead.
11+ *
1012 * A taint tracking configuration for implicit `PendingIntent`s
1113 * being wrapped in another implicit `Intent` that gets started.
1214 */
13- class ImplicitPendingIntentStartConf extends TaintTracking:: Configuration {
15+ deprecated class ImplicitPendingIntentStartConf extends TaintTracking:: Configuration {
1416 ImplicitPendingIntentStartConf ( ) { this = "ImplicitPendingIntentStartConf" }
1517
1618 override predicate isSource ( DataFlow:: Node source , DataFlow:: FlowState state ) {
@@ -52,3 +54,50 @@ class ImplicitPendingIntentStartConf extends TaintTracking::Configuration {
5254 c instanceof DataFlow:: ArrayContent
5355 }
5456}
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