mirror of
https://github.com/github/codeql.git
synced 2026-05-04 13:15:21 +02:00
Add test cases; fix the regex used
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.example.test">
|
||||
</manifest>
|
||||
@@ -0,0 +1,19 @@
|
||||
import java
|
||||
import semmle.code.java.security.SensitiveKeyboardCacheQuery
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class SensitiveKeyboardCacheTest extends InlineExpectationsTest {
|
||||
SensitiveKeyboardCacheTest() { this = "SensitiveKeyboardCacheTest" }
|
||||
|
||||
override string getARelevantTag() { result = "hasResult" }
|
||||
|
||||
override predicate hasActualResult(Location loc, string element, string tag, string value) {
|
||||
exists(AndroidEditableXmlElement el |
|
||||
el = getASensitiveCachedInput() and
|
||||
loc = el.getLocation() and
|
||||
element = el.toString() and
|
||||
tag = "hasResult" and
|
||||
value = ""
|
||||
)
|
||||
}
|
||||
}
|
||||
1
java/ql/test/query-tests/security/CWE-524/Test.java
Normal file
1
java/ql/test/query-tests/security/CWE-524/Test.java
Normal file
@@ -0,0 +1 @@
|
||||
class Test {}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
|
||||
<!-- $hasResult --> <EditText
|
||||
android:id="@+id/test1_password"
|
||||
android:inputType="text"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/test2_safe"
|
||||
android:inputType="text"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/test3_password"
|
||||
android:inputType="textNoSuggestions"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/test4_password"
|
||||
android:inputType="textPassword"/>
|
||||
|
||||
<!-- $hasResult --> <EditText
|
||||
android:id="@+id/test5_bank_account_name"
|
||||
android:inputType="textMultiLine"/>
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user