Update SQLCipher to 4.13.0

This commit is contained in:
Greyson Parrelli
2026-03-09 10:27:51 -04:00
committed by jeffrey-signal
parent 94e28eddd0
commit bdc90f3c02
6 changed files with 96 additions and 8 deletions

View File

@@ -27,6 +27,8 @@ import androidx.annotation.WorkerThread;
import com.bumptech.glide.Glide;
import com.google.android.gms.security.ProviderInstaller;
import net.zetetic.database.Logger;
import org.conscrypt.ConscryptSignal;
import org.greenrobot.eventbus.EventBus;
import org.signal.aesgcmprovider.AesGcmProvider;
@@ -79,7 +81,6 @@ import org.thoughtcrime.securesms.jobs.RestoreOptimizedMediaJob;
import org.thoughtcrime.securesms.jobs.RetrieveProfileJob;
import org.thoughtcrime.securesms.jobs.RetrieveRemoteAnnouncementsJob;
import org.thoughtcrime.securesms.jobmanager.impl.SealedSenderConstraint;
import org.thoughtcrime.securesms.jobs.RetryPendingSendsJob;
import org.thoughtcrime.securesms.jobs.StoryOnboardingDownloadJob;
import org.thoughtcrime.securesms.keyvalue.KeepMessagesDuration;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
@@ -110,6 +111,7 @@ import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.RemoteConfig;
import org.thoughtcrime.securesms.util.SignalLocalMetrics;
import org.thoughtcrime.securesms.util.SignalUncaughtExceptionHandler;
import org.thoughtcrime.securesms.util.SqlCipherLogTarget;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.signal.core.util.Util;
import org.thoughtcrime.securesms.util.VersionTracker;
@@ -161,6 +163,7 @@ public class ApplicationContext extends Application implements AppForegroundObse
SignalDatabase.init(this,
DatabaseSecretProvider.getOrCreateDatabaseSecret(this),
AttachmentSecretProvider.getInstance(this).getOrCreateAttachmentSecret());
Logger.setTarget(SqlCipherLogTarget.INSTANCE);
})
.addBlocking("signal-store", () -> SignalStore.init(this))
.addBlocking("logging", () -> {

View File

@@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.database;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import androidx.annotation.NonNull;
@@ -27,7 +28,9 @@ public final class SqlCipherDeletingErrorHandler implements DatabaseErrorHandler
}
@Override
public void onCorruption(SQLiteDatabase db, String message) {
public void onCorruption(SQLiteDatabase db, SQLiteException exception) {
String message = exception != null ? exception.getMessage() : "Unknown";
try {
Log.e(TAG, "Database '" + databaseName + "' corrupted! Message: " + message + ". Going to try to run some diagnostics.");

View File

@@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.database
import android.app.Application
import android.content.Context
import android.database.sqlite.SQLiteException
import net.zetetic.database.DatabaseErrorHandler
import net.zetetic.database.sqlcipher.SQLiteConnection
import net.zetetic.database.sqlcipher.SQLiteDatabase
@@ -25,7 +26,7 @@ class SqlCipherErrorHandler(private val application: Application, private val da
private val errorHandlingInProgress = AtomicBoolean(false)
}
override fun onCorruption(db: SQLiteDatabase, message: String) {
override fun onCorruption(db: SQLiteDatabase, exception: SQLiteException?) {
if (errorHandlingInProgress.getAndSet(true)) {
Log.w(TAG, "Error handling already in progress, skipping.")
return
@@ -34,10 +35,10 @@ class SqlCipherErrorHandler(private val application: Application, private val da
try {
val result: DiagnosticResults = runDiagnostics(application, db)
var lines: List<String> = result.logs.split("\n")
lines = listOf("Database '$databaseName' corrupted!", "[sqlite] $message", "Diagnostics results:") + lines
lines = listOf("Database '$databaseName' corrupted!", "[sqlite] ${exception?.message}", "Diagnostics results:") + lines
Log.e(TAG, "Database '$databaseName' corrupted!")
Log.e(TAG, "[sqlite] $message")
Log.e(TAG, "[sqlite] ${exception?.message}")
Log.e(TAG, "Diagnostic results:\n ${result.logs}")
if (result is DiagnosticResults.Success) {

View File

@@ -0,0 +1,30 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.thoughtcrime.securesms.util
import net.zetetic.database.LogTarget
import net.zetetic.database.Logger
import org.signal.core.util.logging.Log
object SqlCipherLogTarget : LogTarget {
override fun isLoggable(tag: String?, priority: Int): Boolean {
// Logger.DEBUG logs are extremely verbose, and include things like status updates on cursors being filled
return priority >= Logger.INFO
}
override fun log(priority: Int, tag: String?, message: String?, throwable: Throwable?) {
val tag = tag ?: "SqlCipher"
when (priority) {
Logger.VERBOSE -> Log.v(tag, message, throwable)
Logger.DEBUG -> Log.d(tag, message, throwable)
Logger.INFO -> Log.i(tag, message, throwable)
Logger.WARN -> Log.w(tag, message, throwable)
Logger.ERROR -> Log.e(tag, message, throwable)
Logger.ASSERT -> Log.e(tag, message, throwable)
else -> Log.d(tag, message, throwable)
}
}
}

View File

@@ -133,8 +133,8 @@ androidx-concurrent-futures = "androidx.concurrent:concurrent-futures:1.2.0"
androidx-autofill = "androidx.autofill:autofill:1.1.0"
androidx-biometric = "androidx.biometric:biometric:1.1.0"
androidx-sharetarget = "androidx.sharetarget:sharetarget:1.2.0"
androidx-sqlite = "androidx.sqlite:sqlite:2.4.0"
androidx-sqlite-framework = "androidx.sqlite:sqlite-framework:2.4.0"
androidx-sqlite = "androidx.sqlite:sqlite:2.6.2"
androidx-sqlite-framework = "androidx.sqlite:sqlite-framework:2.6.2"
androidx-profileinstaller = "androidx.profileinstaller:profileinstaller:1.4.1"
androidx-asynclayoutinflater = "androidx.asynclayoutinflater:asynclayoutinflater:1.1.0-alpha01"
androidx-asynclayoutinflater-appcompat = "androidx.asynclayoutinflater:asynclayoutinflater-appcompat:1.1.0-alpha01"
@@ -171,9 +171,9 @@ libsignal-android = { module = "org.signal:libsignal-android", version.ref = "li
protobuf-gradle-plugin = { module = "com.google.protobuf:protobuf-gradle-plugin", version.ref = "protobuf-gradle-plugin" }
signal-aesgcmprovider = "org.signal:aesgcmprovider:0.0.4"
signal-ringrtc = "org.signal:ringrtc-android:2.65.3"
signal-android-database-sqlcipher = "org.signal:sqlcipher-android:4.6.0-S1"
# Third Party
signal-android-database-sqlcipher = "net.zetetic:sqlcipher-android:4.13.0"
greenrobot-eventbus = "org.greenrobot:eventbus:3.0.0"
jackson-core = "com.fasterxml.jackson.core:jackson-databind:2.12.0"
jackson-module-kotlin = "com.fasterxml.jackson.module:jackson-module-kotlin:2.12.0"

View File

@@ -7361,6 +7361,22 @@ https://docs.gradle.org/current/userguide/dependency_verification.html
<sha256 value="b7b5f5fcb12a48f7fdeea82ef205721e3daf366fc77a843a77358def088f63fc" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.sqlite" name="sqlite" version="2.6.2">
<artifact name="sqlite-2.6.2.module">
<sha256 value="4c07c73ad3e06a6e523dcd591d892eda3500ecde14e51977c1f92821e51dbf7e" origin="Generated by Gradle"/>
</artifact>
<artifact name="sqlite-metadata-2.6.2.jar">
<sha256 value="8ca916a05837de00d1e6fd90f5374c111fc54a8f75de3979f2df26c9c97feabd" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.sqlite" name="sqlite-android" version="2.6.2">
<artifact name="sqlite-android-2.6.2.module">
<sha256 value="d1be3d7890b541d28f7677f0a5a6cf74d1cc412efab32cf712f8d16c2ac73f35" origin="Generated by Gradle"/>
</artifact>
<artifact name="sqlite.aar">
<sha256 value="514f8de4f7bdba2fa8d748d2b22fdcdfb623bd3770a667bf0adc0ad259f03ed2" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.sqlite" name="sqlite-framework" version="2.4.0">
<artifact name="sqlite-framework-2.4.0.aar">
<md5 value="e1c63283c4e51e1a3bd671106d377545" origin="Generated by Gradle"/>
@@ -7373,6 +7389,30 @@ https://docs.gradle.org/current/userguide/dependency_verification.html
<sha256 value="15681e94286ebf7121d940765a222b9a7ada2a32a49baa1ad416ef04b6f0f780" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.sqlite" name="sqlite-framework" version="2.6.2">
<artifact name="sqlite-framework-2.6.2.module">
<sha256 value="d2b02979d1c6fbbd399d3a35e8be6906ee03f651c196ad76d79a317ff3beca91" origin="Generated by Gradle"/>
</artifact>
<artifact name="sqlite-framework-metadata-2.6.2.jar">
<sha256 value="6decccb77d31858b1609797d50832beacf7bb4c14e8cfd0ef2ca464ca4f3539e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.sqlite" name="sqlite-framework-android" version="2.6.2">
<artifact name="sqlite-framework-android-2.6.2.module">
<sha256 value="589f0d6b6fc030696f12f89f539efe614978d8a8fdfe0c9d20844dd5243773c1" origin="Generated by Gradle"/>
</artifact>
<artifact name="sqlite-framework.aar">
<sha256 value="b19125c7fff34222e0f380361fc179ab214e4d82e1a50b0c068ca26c851a6231" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.sqlite" name="sqlite-jvm" version="2.6.2">
<artifact name="sqlite-jvm-2.6.2.jar">
<sha256 value="53b050b80e666228a12a0ae72d49531b3d69615ba8fb62733f697f8fdc7fd6f3" origin="Generated by Gradle"/>
</artifact>
<artifact name="sqlite-jvm-2.6.2.module">
<sha256 value="d1b165dd2bee90500733e4ad79024f5f590bfb3825682a894dfbd3274cefb0f8" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.startup" name="startup-runtime" version="1.0.0">
<artifact name="startup-runtime-1.0.0.aar">
<md5 value="aa21a2b31f63f08a1129afc2440bd204" origin="Generated by Gradle"/>
@@ -13192,6 +13232,14 @@ https://docs.gradle.org/current/userguide/dependency_verification.html
<sha256 value="f264dd9f79a1fde10ce5ecc53221eff24be4c9331c830b7d52f2f08a7b633de2" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="net.zetetic" name="sqlcipher-android" version="4.13.0">
<artifact name="sqlcipher-android-4.13.0.aar">
<sha256 value="45a0f77f519ce6be56f371fa484d0d7a88592bca80977757660ad20deeab7eb1" origin="Generated by Gradle"/>
</artifact>
<artifact name="sqlcipher-android-4.13.0.module">
<sha256 value="bb544ef6e9067038ce451a99f4e0e335e5978205db2fa4f71eabdf2e988bf82d" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.antlr" name="antlr4-runtime" version="4.7.1">
<artifact name="antlr4-runtime-4.7.1.jar">
<md5 value="0223e36b3a3fadd05a52221828a4fcf1" origin="Generated by Gradle"/>
@@ -14963,6 +15011,9 @@ https://docs.gradle.org/current/userguide/dependency_verification.html
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-stdlib" version="2.1.20">
<artifact name="kotlin-stdlib-2.1.20-all.jar">
<sha256 value="81e07de34e84b29e14f3fdef902f4bc4cf1d5da959b867df683fbe1cc54ce1e1" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-stdlib-2.1.20.module">
<md5 value="cf65399ca828b987dcb2dc62faed3c18" origin="Generated by Gradle"/>
<sha1 value="9cac80175523f91b769c08efcbb7c7ee488a0ca0" origin="Generated by Gradle"/>