Skip to content

Commit 47bf556

Browse files
authored
Merge pull request github#15709 from atorralba/atorralba/java/enable-widget-taint-steps
Java: Re-enable Widget.qll flow steps
2 parents 6c8105f + 759b747 commit 47bf556

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: fix
3+
---
4+
* Some flow steps related to `android.text.Editable.toString` that were accidentally disabled have been re-enabled.

java/ql/lib/semmle/code/java/dataflow/FlowSteps.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ private module Frameworks {
1414
private import semmle.code.java.frameworks.android.Intent
1515
private import semmle.code.java.frameworks.android.Slice
1616
private import semmle.code.java.frameworks.android.SQLite
17+
private import semmle.code.java.frameworks.android.Widget
1718
private import semmle.code.java.frameworks.apache.Lang
1819
private import semmle.code.java.frameworks.ApacheHttp
1920
private import semmle.code.java.frameworks.guava.Guava

java/ql/test/query-tests/security/CWE-312/android/CleartextStorage/CleartextStorageSharedPrefsTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import android.content.Context;
33
import android.content.SharedPreferences;
44
import android.content.SharedPreferences.Editor;
5+
import android.widget.EditText;
56
import androidx.security.crypto.MasterKey;
67
import androidx.security.crypto.EncryptedSharedPreferences;
78
import java.nio.charset.StandardCharsets;
@@ -101,4 +102,11 @@ public void testSetSharedPrefs7(Context context, String name, String password) {
101102
sharedPrefs.edit().putString("name", name).apply(); // Safe
102103
sharedPrefs.edit().putString("password", password).apply(); // $hasCleartextStorageSharedPrefs
103104
}
105+
106+
public void testSetSharedPrefs7(Context context, EditText name, EditText password) {
107+
SharedPreferences sharedPrefs =
108+
context.getSharedPreferences("user_prefs", Context.MODE_PRIVATE);
109+
sharedPrefs.edit().putString("name", name.getText().toString()).apply(); // Safe
110+
sharedPrefs.edit().putString("password", password.getText().toString()).apply(); // $hasCleartextStorageSharedPrefs
111+
}
104112
}

0 commit comments

Comments
 (0)