Skip to content

Commit b3d9d08

Browse files
Add tests
1 parent d325404 commit b3d9d08

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import android.webkit.WebView;
2+
3+
class Test {
4+
boolean DEBUG_BUILD;
5+
6+
void test1() {
7+
WebView.setWebContentsDebuggingEnabled(true); // $hasValueFlow
8+
}
9+
10+
void test2(){
11+
if (DEBUG_BUILD) {
12+
WebView.setWebContentsDebuggingEnabled(true);
13+
}
14+
}
15+
16+
void test3(boolean enabled){
17+
WebView.setWebContentsDebuggingEnabled(enabled); // $hasValueFlow
18+
}
19+
20+
void test4(){
21+
test3(true);
22+
}
23+
}

java/ql/test/query-tests/security/CWE-489/webview-debugging/WebviewDebuggingEnabled.expected

Whitespace-only changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import java
2+
import TestUtilities.InlineFlowTest
3+
import semmle.code.java.security.WebviewDubuggingEnabledQuery
4+
5+
class HasFlowTest extends InlineFlowTest {
6+
override DataFlow::Configuration getTaintFlowConfig() { none() }
7+
8+
override DataFlow::Configuration getValueFlowConfig() {
9+
result = any(WebviewDebugEnabledConfig c)
10+
}
11+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/google-android-9.0.0

0 commit comments

Comments
 (0)