Skip to content

Commit 16529cd

Browse files
committed
Add failing test
1 parent b70e21d commit 16529cd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

java/ql/test/query-tests/security/CWE-749/UnsafeActivityKt.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,19 @@ import android.webkit.WebViewClient
99
class UnsafeActivityKt : Activity() {
1010
override fun onCreate(savedInstanceState : Bundle) {
1111

12+
val src : String = intent.extras.getString("url")
13+
1214
val wv = findViewById<WebView>(-1)
1315
// Implicit not-nulls happening here
1416
wv.settings.setJavaScriptEnabled(true)
1517
wv.settings.setAllowFileAccessFromFileURLs(true)
1618

17-
val thisUrl : String = intent.extras.getString("url")
18-
wv.loadUrl(thisUrl) // $ hasUnsafeAndroidAccess
19+
wv.loadUrl(src) // $ hasUnsafeAndroidAccess
20+
21+
val wv2 = findViewById<WebView>(-1)
22+
wv2.apply {
23+
settings.setJavaScriptEnabled(true)
24+
}
25+
wv2.loadUrl(src) // $ hasUnsafeAndroidAccess
1926
}
2027
}

0 commit comments

Comments
 (0)