Add tests

This commit is contained in:
Joe Farebrother
2022-08-31 10:31:38 +01:00
parent d32540469b
commit b3d9d08750
4 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import android.webkit.WebView;
class Test {
boolean DEBUG_BUILD;
void test1() {
WebView.setWebContentsDebuggingEnabled(true); // $hasValueFlow
}
void test2(){
if (DEBUG_BUILD) {
WebView.setWebContentsDebuggingEnabled(true);
}
}
void test3(boolean enabled){
WebView.setWebContentsDebuggingEnabled(enabled); // $hasValueFlow
}
void test4(){
test3(true);
}
}

View File

@@ -0,0 +1,11 @@
import java
import TestUtilities.InlineFlowTest
import semmle.code.java.security.WebviewDubuggingEnabledQuery
class HasFlowTest extends InlineFlowTest {
override DataFlow::Configuration getTaintFlowConfig() { none() }
override DataFlow::Configuration getValueFlowConfig() {
result = any(WebviewDebugEnabledConfig c)
}
}

View File

@@ -0,0 +1 @@
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/google-android-9.0.0