mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #11628 from egregius313/egregius313/android-webview-addjavascriptinterface-dataflow
Java: Add parameters of methods annotated @JavascriptInterface as remote flow sources
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* Added an external flow source for the parameters of methods annotated with `android.webkit.JavascriptInterface`.
|
||||
@@ -298,3 +298,16 @@ class OnActivityResultIntentSource extends OnActivityResultIncomingIntent, Remot
|
||||
|
||||
override string getSourceType() { result = "Android onActivityResult incoming Intent" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A parameter of a method annotated with the `android.webkit.JavascriptInterface` annotation.
|
||||
*/
|
||||
class AndroidJavascriptInterfaceMethodParameter extends RemoteFlowSource {
|
||||
AndroidJavascriptInterfaceMethodParameter() {
|
||||
exists(JavascriptInterfaceMethod m | this.asParameter() = m.getAParameter())
|
||||
}
|
||||
|
||||
override string getSourceType() {
|
||||
result = "Parameter of method with JavascriptInterface annotation"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,3 +85,10 @@ class ShouldOverrideUrlLoading extends Method {
|
||||
this.hasName("shouldOverrideUrlLoading")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A method annotated with the `android.webkit.JavascriptInterface` annotation.
|
||||
*/
|
||||
class JavascriptInterfaceMethod extends Method {
|
||||
JavascriptInterfaceMethod() { this.hasAnnotation("android.webkit", "JavascriptInterface") }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import android.webkit.JavascriptInterface;
|
||||
|
||||
public class AndroidExposedObject {
|
||||
public void sink(Object o) {
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void test(String arg) {
|
||||
sink(arg); // $hasRemoteValueFlow
|
||||
}
|
||||
}
|
||||
7
java/ql/test/stubs/google-android-9.0.0/android/webkit/JavascriptInterface.java
generated
Normal file
7
java/ql/test/stubs/google-android-9.0.0/android/webkit/JavascriptInterface.java
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
package android.webkit;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
public abstract @interface JavascriptInterface {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user