Clear storageIDs from recipient rows with bad data.

TBH this shouldn't affect external users. I believe this bad data was
only experienced internally a long time ago. But we want to make sure we
don't continue to sync that bad data, so we're just stripping the
storageID's from it.
fork-5.53.8
Greyson Parrelli 2021-04-13 12:13:05 -04:00 zatwierdzone przez GitHub
rodzic 20b98122c1
commit 0020c7c6dc
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -170,8 +170,9 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper implements SignalDatab
private static final int ABOUT = 89;
private static final int SPLIT_SYSTEM_NAMES = 90;
private static final int PAYMENTS = 91;
private static final int CLEAN_STORAGE_IDS = 92;
private static final int DATABASE_VERSION = 91;
private static final int DATABASE_VERSION = 92;
private static final String DATABASE_NAME = "signal.db";
private final Context context;
@ -1291,6 +1292,13 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper implements SignalDatab
db.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS receipt_public_key_index ON payments (receipt_public_key);");
}
if (oldVersion < CLEAN_STORAGE_IDS) {
ContentValues values = new ContentValues();
values.putNull("storage_service_key");
int count = db.update("recipient", values, "storage_service_key NOT NULL AND ((phone NOT NULL AND INSTR(phone, '+') = 0) OR (group_id NOT NULL AND (LENGTH(group_id) != 85 and LENGTH(group_id) != 53)))", null);
Log.i(TAG, "There were " + count + " bad rows that had their storageID removed.");
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();