Skip to content

Commit caab1c3

Browse files
authored
Merge pull request github#6963 from atorralba/atorralba/android-onactivityresult-source
Android: Add the Intent parameter of the `onActivityResult` method as a source
2 parents 29e87b3 + 62f847a commit caab1c3

File tree

16 files changed

+5519
-12
lines changed

16 files changed

+5519
-12
lines changed

config/identical-files.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl5.qll",
88
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl6.qll",
99
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplForSerializability.qll",
10+
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplForOnActivityResult.qll",
1011
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll",
1112
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll",
1213
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll",

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import semmle.code.java.frameworks.android.WebView
1717
import semmle.code.java.frameworks.JaxWS
1818
import semmle.code.java.frameworks.javase.WebSocket
1919
import semmle.code.java.frameworks.android.Android
20+
import semmle.code.java.frameworks.android.OnActivityResultSource
2021
import semmle.code.java.frameworks.android.Intent
2122
import semmle.code.java.frameworks.play.Play
2223
import semmle.code.java.frameworks.spring.SpringWeb
@@ -264,3 +265,13 @@ class ExportedAndroidContentProviderInput extends RemoteFlowSource, AndroidConte
264265

265266
override string getSourceType() { result = "Exported Android content provider source" }
266267
}
268+
269+
/**
270+
* The data Intent parameter in the `onActivityResult` method in an Activity or Fragment that
271+
* calls `startActivityForResult` with an implicit Intent.
272+
*/
273+
class OnActivityResultIntentSource extends OnActivityResultIncomingIntent, RemoteFlowSource {
274+
OnActivityResultIntentSource() { this.isRemoteSource() }
275+
276+
override string getSourceType() { result = "Android onActivityResult incoming Intent" }
277+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Provides classes for performing local (intra-procedural) and
3+
* global (inter-procedural) data flow analyses (for internal use only).
4+
*
5+
* This copy of the library is exclusively for use by `OnActivityResultSource.qll` and
6+
* related libraries. Configurations computed using this instance of the library
7+
* are in scope whenever `java.qll` is imported, and are used to compute among
8+
* other things `RemoteFlowSource`s.
9+
*/
10+
11+
import java
12+
13+
/**
14+
* Provides classes for performing local (intra-procedural) and
15+
* global (inter-procedural) data flow analyses (for internal use only).
16+
*/
17+
module DataFlowForOnActivityResult {
18+
import semmle.code.java.dataflow.internal.DataFlowImplForOnActivityResult
19+
}

0 commit comments

Comments
 (0)