Skip to content

Commit 460ffc8

Browse files
Add additional test cases
1 parent 3abd670 commit 460ffc8

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

java/ql/test/query-tests/security/CWE-200/semmle/tests/SensitiveTextView/R.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public static final class id {
1414
public static final int test10 = 10;
1515
public static final int test11 = 11;
1616
public static final int test12 = 12;
17+
public static final int test13 = 13;
18+
public static final int test14 = 14;
1719
}
1820

1921
public static final class string {

java/ql/test/query-tests/security/CWE-200/semmle/tests/SensitiveTextView/Test.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,18 @@ void test(String password) {
6060
// GOOD: Visibility of parent set to invisible in XML
6161
EditText test12 = findViewById(R.id.test12);
6262
test12.setText(password);
63+
64+
// GOOD: Input type set to textPassword in XML
65+
EditText test13 = findViewById(R.id.test13);
66+
test13.setText(password);
67+
68+
test14 = findViewById(R.id.test14);
69+
}
70+
71+
EditText test14;
72+
73+
void test2(String password) {
74+
// GOOD: Input type set to textPassword in XML
75+
test14.setText(password);
6376
}
6477
}

java/ql/test/query-tests/security/CWE-200/semmle/tests/SensitiveTextView/res/layout/Test.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,12 @@
5050
android:id="@+id/test12"/>
5151
</LinearLayout>
5252

53+
<EditText
54+
android:id="@id/test13"
55+
android:inputType="textPassword"/>
56+
57+
<EditText
58+
android:id="@+id/test14"
59+
android:inputType="textPassword"/>
60+
5361
</LinearLayout>

0 commit comments

Comments
 (0)