Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix method name in LocalDatabaseOpenMethodAccess
  • Loading branch information
atorralba committed Jan 21, 2022
commit 4f253590f184f05109d30e98c3e8b699d8f33d43
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class LocalDatabaseOpenMethodAccess extends Storable, Call {
m.hasName("getWritableDatabase")
or
m.getDeclaringType() instanceof TypeSQLiteDatabase and
m.hasName(["create", "open%Database", "compileStatement"])
m.hasName(["create", "openDatabase", "openOrCreateDatabase", "compileStatement"])
or
m.getDeclaringType().getASupertype*() instanceof TypeContext and
m.hasName("openOrCreateDatabase")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,20 @@ public void testCleartextStorageAndroiDatabaseSafe2(Context ctx, String name, St
db.execSQL("DROP TABLE passwords;"); // Safe - no sensitive value being stored
}

public void testCleartextStorageAndroiDatabase1(Context ctx, String name, String password) {
public void testCleartextStorageAndroiDatabase0(Context ctx, String name, String password) {
SQLiteDatabase db = ctx.openOrCreateDatabase("test", Context.MODE_PRIVATE, null);
String query = "INSERT INTO users VALUES ('" + name + "', '" + password + "');";
db.execSQL(query); // $ hasCleartextStorageAndroidDatabase
}

public void testCleartextStorageAndroiDatabase1(Context ctx, String name, String password) {
SQLiteDatabase db = SQLiteDatabase.openDatabase("", null, 0);
String query = "INSERT INTO users VALUES ('" + name + "', '" + password + "');";
db.execSQL(query); // $ hasCleartextStorageAndroidDatabase
}

public void testCleartextStorageAndroiDatabase2(String name, String password) {
SQLiteDatabase db = SQLiteDatabase.create(null);
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase("", null);
String query = "INSERT INTO users VALUES (?, ?)";
db.execSQL(query, new String[] {name, password}); // $ hasCleartextStorageAndroidDatabase
}
Expand Down