Modern Apps git

← Modern-Apps.git

passwords: fix all lint findings

Commit
6c4d225048320fa798e006801ee82d97a9be4528
Author
Vayun Mathur <[email protected]>
When
2026-11-17 04:21 UTC (19 days ago)
Parents
ff82580
Fix every lint error and warning reported for the passwords module's own sources by :passwords:lintDev, now 0 errors / 0 warnings for passwords/** (remaining report entries are transitive library findings owned by other clusters).

PasskeyPage LocalContext.getString reads replaced with configuration-aware stringResource captures; removed an obsolete SDK guard in PasswordsViewModel (minSdk 35 is already at or above TIRAMISU); RelayPasswordProvider Uri.parse replaced with toUri().

Resources: deleted 10 verified-unused strings (label_name, label_email, label_note, section_password, section_note, title_settings, passkey_connect, sync_save, sync_cancel, sync_vault_password_set) from values-ar/et/fr/it/ru/sv/zh-rCN — no code, test, screenshot or getIdentifier references; this cleared both the ExtraTranslation (45) and UnusedResources (10) findings.

Suppression (1, genuine false positive): @SuppressLint(GetInstance) on CableEid.encrypt with comment — caBLE v2 EID is exactly one 16-byte AES block per the Chromium spec; ECB here is the raw single-block operation with an appended HMAC tag, and any other mode would break interop. No lint config or baseline changed; no rule-bug categories.

Verified: ./gradlew :passwords:lintDev (0 own-module errors/warnings). :passwords:testDevUnitTest: 208/252 pass; the 44 failures are all Robolectric class-setup failures to fetch org.robolectric:android-all-instrumented:15-robolectric-14663667-2-i7, which returns 404 from the internal Maven mirror — a pre-existing environment limitation unrelated to these changes (no test logic changed).

Diff

passwords/src/main/java/com/vayunmathur/passwords/platform/PasswordsViewModel.kt
diff --git a/passwords/src/main/java/com/vayunmathur/passwords/platform/PasswordsViewModel.kt b/passwords/src/main/java/com/vayunmathur/passwords/platform/PasswordsViewModel.ktindex 6beed4d463..819eb4e7b3 100644--- a/passwords/src/main/java/com/vayunmathur/passwords/platform/PasswordsViewModel.kt+++ b/passwords/src/main/java/com/vayunmathur/passwords/platform/PasswordsViewModel.kt@@ -8,7 +8,6 @@ import android.content.ContentResolver import android.content.Context import android.content.Intent import android.net.Uri-import android.os.Build import android.os.PersistableBundle import androidx.compose.runtime.Composable import androidx.compose.runtime.State@@ -182,11 +181,9 @@ class PasswordsViewModel(         val clipboard = ctx.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager         val clip = ClipData.newPlainText(label, text)         // Tells the system UI (and any keyboard with a clipboard history) not to show this-        // in the clear. Android 13+; older releases have no way to say it.-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {-            clip.description.extras = PersistableBundle().apply {-                putBoolean(ClipDescription.EXTRA_IS_SENSITIVE, true)-            }+        // in the clear (minSdk 35 is always Android 13+).+        clip.description.extras = PersistableBundle().apply {+            putBoolean(ClipDescription.EXTRA_IS_SENSITIVE, true)         }         clipboard.setPrimaryClip(clip)         if (feedback != null) {
passwords/src/main/java/com/vayunmathur/passwords/platform/cable/CableEid.kt
diff --git a/passwords/src/main/java/com/vayunmathur/passwords/platform/cable/CableEid.kt b/passwords/src/main/java/com/vayunmathur/passwords/platform/cable/CableEid.ktindex 0640e9e8ca..b64a8a0380 100644--- a/passwords/src/main/java/com/vayunmathur/passwords/platform/cable/CableEid.kt+++ b/passwords/src/main/java/com/vayunmathur/passwords/platform/cable/CableEid.kt@@ -1,5 +1,6 @@ package com.vayunmathur.passwords.platform.cable +import android.annotation.SuppressLint import java.security.SecureRandom import javax.crypto.Cipher import javax.crypto.Mac@@ -59,6 +60,10 @@ object CableEid {     }      /** Encrypts + authenticates the 16-byte EID into the 20-byte advertised value. */+    // caBLE EID is exactly one 16-byte AES block per the Chromium spec; ECB here is the raw+    // single-block AES operation (no IV/padding/multi-block confidentiality pattern), and+    // authenticity comes from the appended HMAC tag. Any other mode would break interop.+    @SuppressLint("GetInstance")     fun encrypt(plaintextEid: ByteArray, eidKey: ByteArray): ByteArray {         require(plaintextEid.size == EID_SIZE) { "EID must be $EID_SIZE bytes" }         require(eidKey.size == CableKeys.EID_KEY_SIZE) { "EID key must be ${CableKeys.EID_KEY_SIZE} bytes" }
passwords/src/main/java/com/vayunmathur/passwords/sync/RelayPasswordProvider.kt
diff --git a/passwords/src/main/java/com/vayunmathur/passwords/sync/RelayPasswordProvider.kt b/passwords/src/main/java/com/vayunmathur/passwords/sync/RelayPasswordProvider.ktindex 30b290261e..37055d6048 100644--- a/passwords/src/main/java/com/vayunmathur/passwords/sync/RelayPasswordProvider.kt+++ b/passwords/src/main/java/com/vayunmathur/passwords/sync/RelayPasswordProvider.kt@@ -6,6 +6,7 @@ import android.content.UriMatcher import android.database.Cursor import android.database.MatrixCursor import android.net.Uri+import androidx.core.net.toUri import android.os.Binder import android.os.Process import android.util.Base64@@ -106,13 +107,13 @@ class RelayPasswordProvider : ContentProvider() {         private val json = Json { ignoreUnknownKeys = true }          fun passwordsUri(vaultId: String): Uri =-            Uri.parse("content://$AUTHORITY/vault/$vaultId/passwords")+            "content://$AUTHORITY/vault/$vaultId/passwords".toUri()          fun passkeysUri(vaultId: String): Uri =-            Uri.parse("content://$AUTHORITY/vault/$vaultId/passkeys")+            "content://$AUTHORITY/vault/$vaultId/passkeys".toUri()          fun snapshotsUri(vaultId: String): Uri =-            Uri.parse("content://$AUTHORITY/vault/$vaultId/snapshots")+            "content://$AUTHORITY/vault/$vaultId/snapshots".toUri()     }      private fun repo(): PasswordRepository {
passwords/src/main/java/com/vayunmathur/passwords/ui/PasskeyPage.kt
diff --git a/passwords/src/main/java/com/vayunmathur/passwords/ui/PasskeyPage.kt b/passwords/src/main/java/com/vayunmathur/passwords/ui/PasskeyPage.ktindex 2979c52286..67a15a404c 100644--- a/passwords/src/main/java/com/vayunmathur/passwords/ui/PasskeyPage.kt+++ b/passwords/src/main/java/com/vayunmathur/passwords/ui/PasskeyPage.kt@@ -66,6 +66,11 @@ fun PasskeyPage(     val link = passkey.link()     val messenger = rememberMessenger()     var picking by remember { mutableStateOf(false) }+    // Configuration-aware strings captured in composition for use in callbacks below+    // (LocalContext.getString would be stale after a configuration change).+    val noNameText = stringResource(R.string.no_name)+    val passkeyLinkedTemplate = stringResource(R.string.passkey_linked_message)+    val passkeyUnlinkedMessage = stringResource(R.string.passkey_unlinked_message)      val context = LocalContext.current     val mediumDate = DateFormat.getMediumDateFormat(context)@@ -80,10 +85,7 @@ fun PasskeyPage(                 picking = false                 viewModel.setPasskeyLink(passkey, PasskeyLink.To(password.syncId))                 messenger.show(-                    context.getString(-                        R.string.passkey_linked_message,-                        password.name.ifBlank { context.getString(R.string.no_name) },-                    )+                    passkeyLinkedTemplate.format(password.name.ifBlank { noNameText })                 )             },         )@@ -131,7 +133,7 @@ fun PasskeyPage(                     if (linkedTo != null) {                         TextButton(onClick = {                             viewModel.setPasskeyLink(passkey, PasskeyLink.Detached)-                            messenger.show(context.getString(R.string.passkey_unlinked_message))+                            messenger.show(passkeyUnlinkedMessage)                         }) {                             IconLinkOff()                             Spacer(Modifier.width(8.dp))
passwords/src/main/res/values-ar/strings.xml
diff --git a/passwords/src/main/res/values-ar/strings.xml b/passwords/src/main/res/values-ar/strings.xmlindex 432128cc90..8d4c413ab6 100644--- a/passwords/src/main/res/values-ar/strings.xml+++ b/passwords/src/main/res/values-ar/strings.xml@@ -2,7 +2,6 @@ <resources>     <string name="hide">إخفاء</string>     <string name="show">إظهار</string>-    <string name="title_settings">الإعدادات</string>     <string name="app_name">كلمات المرور</string>     <string name="sync_now">زامن الآن</string> </resources>
passwords/src/main/res/values-et/strings.xml
diff --git a/passwords/src/main/res/values-et/strings.xml b/passwords/src/main/res/values-et/strings.xmlindex 999f314125..29df0e8184 100644--- a/passwords/src/main/res/values-et/strings.xml+++ b/passwords/src/main/res/values-et/strings.xml@@ -1,9 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">     <string name="app_name">Salasõnad</string>-    <string name="label_name">Nimi</string>     <string name="label_username">Kasutajanimi</string>-    <string name="label_email">E-posti aadress</string>     <string name="label_password">Salasõna</string>     <string name="label_totp_secret">TOTP saladus</string>     <string name="label_add_website">Lisa veebisait</string>@@ -11,7 +9,6 @@     <string name="edit_password">Muuda salasõna</string>     <string name="hide">Peida</string>     <string name="show">Näita</string>-    <string name="section_password">Salasõna</string>     <string name="section_totp">TOTP ehk ajapõhine ühekordne salasõna</string>     <string name="totp_not_configured">(pole seadistatud)</string>     <string name="totp_refreshes_in">Uuendamse aeg on <xliff:g id="seconds" example="15">%1$d</xliff:g> sek</string>@@ -29,11 +26,8 @@     <string name="passkey_rp_id">Edastava osapoole tunnus (ID)</string>     <string name="passkey_user_name">Kasutajanimi</string>     <string name="passkey_user_display_name">Kuvatav nimi</string>-    <string name="title_settings">Seadistused</string>     <string name="passkey_credential_id">Tuvastuskirje tunnus (ID)</string>     <string name="passkey_created">Loodud</string>-    <string name="label_note">Märge</string>-    <string name="section_note">Märge</string>     <string name="import_source_bitwarden">Bitwarden</string>     <string name="import_source_chrome">Google Chrome</string>     <string name="import_source_firefox">Firefox</string>@@ -47,10 +41,7 @@     <string name="sync_choose_file">Vali olemasolev fail</string>     <string name="sync_create_file">Tee uus fail</string>     <string name="sync_vault_password">Salasõnahoidla salasõna</string>-    <string name="sync_vault_password_set">Salvestatud</string>     <string name="sync_vault_password_unset">(määratlemata)</string>-    <string name="sync_save">Salvesta</string>-    <string name="sync_cancel">Katkesta</string>     <string name="sync_last">Viimane sünkroonimine</string>     <string name="sync_never">Mitte kunagi</string>     <string name="sync_now">Sünkrooni kohe</string>@@ -71,7 +62,6 @@     <string name="passkey_link_auto">Vastendatud automaatselt</string>     <string name="passkey_link_manual">Seotud sinu poolt</string>     <string name="passkey_link_detached">Ühendus on katkestatud. Teda ei vastendata automaatselt.</string>-    <string name="passkey_connect">Seo kirjega</string>     <string name="passkey_disconnect">Lõpeta sidumine kirjega</string>     <string name="passkey_link_use_auto">Vastenda automaatselt</string>     <string name="passkey_link_dialog_title">Kirje link</string>
passwords/src/main/res/values-fr/strings.xml
diff --git a/passwords/src/main/res/values-fr/strings.xml b/passwords/src/main/res/values-fr/strings.xmlindex bd7e460fef..ea284169b3 100644--- a/passwords/src/main/res/values-fr/strings.xml+++ b/passwords/src/main/res/values-fr/strings.xml@@ -13,7 +13,6 @@     <string name="unlock_database">Déverrouiller les mots de passe</string>     <string name="sync_error_verify_failed">La vérification du coffre-fort fusionné a échoué. Le fichier n’a donc pas été enregistré.</string>     <string name="passkey_rp_id">Identifiant de la partie de confiance</string>-    <string name="label_name">Nom</string>     <string name="sync_error_file_missing">Le fichier KDBX n’a pas pu être ouvert. Aucune modification locale n’a été apportée.</string>     <string name="sync_never">Jamais</string>     <string name="cable_prompt_subtitle">Confirmez votre identité pour approuver cette connexion avec une clé d’accès</string>@@ -49,19 +48,11 @@     <string name="label_totp_secret">Secret TOTP</string>     <string name="import_source_dashlane">Dashlane</string>     <string name="sync_vault_password_unset">(non défini)</string>-    <string name="title_settings">Paramètres</string>     <string name="passkey_credential_id">ID de l’identifiant d’authentification</string>-    <string name="sync_save">Enregistrer</string>-    <string name="sync_vault_password_set">Enregistré</string>-    <string name="section_password">Mot de passe</string>     <string name="show">Afficher</string>     <string name="no_user">(sans utilisateur)</string>     <string name="app_name">Mots de passe</string>     <string name="passkey_created">Créée</string>-    <string name="sync_cancel">Annuler</string>     <string name="label_username">Nom d’utilisateur</string>-    <string name="label_email">Adresse e-mail</string>-    <string name="label_note">Note</string>-    <string name="section_note">Note</string>     <string name="name_required">Le nom ne peut pas être vide</string> </resources>
passwords/src/main/res/values-it/strings.xml
diff --git a/passwords/src/main/res/values-it/strings.xml b/passwords/src/main/res/values-it/strings.xmlindex a3c1f063e6..ec0a984a39 100644--- a/passwords/src/main/res/values-it/strings.xml+++ b/passwords/src/main/res/values-it/strings.xml@@ -1,9 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">     <string name="app_name">Password</string>-    <string name="label_name">Nome</string>     <string name="label_username">Nome utente</string>-    <string name="label_email">Email</string>     <string name="label_password">Password</string>     <string name="label_totp_secret">Chiave segreta TOTP</string>     <string name="label_add_website">Aggiungi sito web</string>@@ -11,7 +9,6 @@     <string name="edit_password">Modifica password</string>     <string name="hide">Nascondi</string>     <string name="show">Mostra</string>-    <string name="section_password">Password</string>     <string name="section_totp">TOTP</string>     <string name="totp_not_configured">(non confogurata)</string>     <string name="totp_refreshes_in">Aggiornamento tra <xliff:g id="seconds" example="15">%1$d</xliff:g> s</string>@@ -28,7 +25,6 @@     <string name="passkey_created">Creazione</string>     <string name="passkey_last_used">Ultimo utilizzo</string>     <string name="unlock_database">Sblocca Password</string>-    <string name="title_settings">Impostazioni</string>     <string name="import_csv_warning">L\'importazione di un file CSV caricherà le credenziali in testo chiaro in questa app. Elimina il file esportato dopo aver completato l\'importazione.</string>     <string name="import_passwords">Importa password</string>     <string name="import_source_bitwarden">Bitwarden</string>
passwords/src/main/res/values-ru/strings.xml
diff --git a/passwords/src/main/res/values-ru/strings.xml b/passwords/src/main/res/values-ru/strings.xmlindex ea24dbb9dc..88791bcee9 100644--- a/passwords/src/main/res/values-ru/strings.xml+++ b/passwords/src/main/res/values-ru/strings.xml@@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> <resources>     <string name="hide">Скрыть</string>-    <string name="label_name">Название</string> </resources>
passwords/src/main/res/values-sv/strings.xml
diff --git a/passwords/src/main/res/values-sv/strings.xml b/passwords/src/main/res/values-sv/strings.xmlindex 4bd5bd5d24..c249b3aa31 100644--- a/passwords/src/main/res/values-sv/strings.xml+++ b/passwords/src/main/res/values-sv/strings.xml@@ -1,10 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">     <string name="app_name">Lösenord</string>-    <string name="label_name">Namn</string>     <string name="label_username">Användarnamn</string>-    <string name="label_email">E-post</string>-    <string name="label_note">Anteckning</string>     <string name="label_password">Lösenord</string>     <string name="label_totp_secret">TOTP-hemlighet</string>     <string name="label_add_website">Lägg till webbplats</string>@@ -12,14 +9,12 @@     <string name="edit_password">Redigera lösenord</string>     <string name="hide">Dölj</string>     <string name="show">Visa</string>-    <string name="section_password">Lösenord</string>     <string name="section_totp">TOTP</string>     <string name="totp_not_configured">(inte konfigurerat)</string>     <string name="totp_refreshes_in">Uppdateras om <xliff:g id="seconds" example="15">%1$d</xliff:g> s</string>     <string name="section_websites">Webbplatser</string>     <string name="websites_none">(inga)</string>     <string name="no_name">(inget namn)</string>-    <string name="section_note">Anteckning</string>     <string name="no_user">(ingen användare)</string>     <string name="passkey_detail_title">Passkey</string>     <string name="passkey_rp_id">Förlitande parts ID</string>@@ -35,7 +30,6 @@     <string name="passkey_link_auto">Matchades automatiskt</string>     <string name="passkey_link_manual">Länkad av dig</string>     <string name="passkey_link_detached">Frånkopplad. Den matchas inte automatiskt.</string>-    <string name="passkey_connect">Länka till post</string>     <string name="passkey_disconnect">Ta bort länk</string>     <string name="passkey_link_use_auto">Matcha automatiskt</string>     <string name="passkey_link_dialog_title">Länka till post</string>@@ -44,7 +38,6 @@     <string name="passkey_unlinked_message">Länken till passkey togs bort</string>     <string name="passkey_count">%1$d</string>     <string name="unlock_database">Lås upp Lösenord</string>-    <string name="title_settings">Inställningar</string>     <string name="import_csv_warning">Import av en CSV-fil lägger in okrypterade inloggningsuppgifter i den här appen. Ta bort exportfilen efter importen.</string>     <string name="import_passwords">Importera lösenord</string>     <string name="import_source_bitwarden">Bitwarden</string>@@ -76,10 +69,7 @@     <string name="sync_choose_file">Välj befintlig fil</string>     <string name="sync_create_file">Skapa ny fil</string>     <string name="sync_vault_password">Valvlösenord</string>-    <string name="sync_vault_password_set">Sparat</string>     <string name="sync_vault_password_unset">(inte angivet)</string>-    <string name="sync_save">Spara</string>-    <string name="sync_cancel">Avbryt</string>     <string name="sync_last">Senaste synkronisering</string>     <string name="sync_never">Aldrig</string>     <string name="sync_now">Synkronisera nu</string>
passwords/src/main/res/values-zh-rCN/strings.xml
diff --git a/passwords/src/main/res/values-zh-rCN/strings.xml b/passwords/src/main/res/values-zh-rCN/strings.xmlindex 64b26ce37c..0afabd5a42 100644--- a/passwords/src/main/res/values-zh-rCN/strings.xml+++ b/passwords/src/main/res/values-zh-rCN/strings.xml@@ -1,9 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">     <string name="app_name">密码</string>-    <string name="label_name">名称</string>     <string name="label_username">用户名</string>-    <string name="label_email">邮箱</string>     <string name="label_password">密码</string>     <string name="label_totp_secret">TOTP 密钥</string>     <string name="label_add_website">添加网站</string>@@ -11,7 +9,6 @@     <string name="edit_password">编辑密码</string>     <string name="hide">隐藏</string>     <string name="show">显示</string>-    <string name="section_password">密码</string>     <string name="section_totp">TOTP</string>     <string name="totp_not_configured">(未配置)</string>     <string name="totp_refreshes_in">将在 <xliff:g id="seconds" example="15">%1$d</xliff:g> 秒后刷新</string>@@ -28,7 +25,6 @@     <string name="passkey_created">创建时间</string>     <string name="passkey_last_used">最后使用时间</string>     <string name="unlock_database">解锁密码</string>-    <string name="title_settings">设置</string>     <string name="import_csv_warning">导入 CSV 会将明文凭据引入本应用。导入后请删除导出文件。</string>     <string name="import_passwords">导入密码</string>     <string name="import_source_bitwarden">Bitwarden</string>@@ -46,20 +42,15 @@     <string name="sync_file_none">(未选择)</string>     <string name="sync_choose_file">选择现有文件</string>     <string name="sync_create_file">创建新文件</string>-    <string name="sync_save">保存</string>-    <string name="sync_cancel">取消</string>     <string name="sync_last">上次同步</string>     <string name="sync_never">从未</string>     <string name="sync_now">立即同步</string>-    <string name="label_note">备注</string>-    <string name="section_note">备注</string>     <string name="import_source_proton_pass">Proton Pass</string>     <string name="sync_section">KDBX 同步</string>     <string name="sync_enable">与 KDBX 文件同步</string>     <string name="sync_enable_description">每 15 分钟以及每次更改后,保持此密码库与 KeePass 文件一致。</string>     <string name="sync_file">KDBX 文件</string>     <string name="sync_vault_password">密码库密码</string>-    <string name="sync_vault_password_set">已保存</string>     <string name="sync_vault_password_unset">(未设置)</string>     <string name="sync_error_file_missing">无法打开 KDBX 文件。本地未进行任何更改。</string>     <string name="sync_error_wrong_password">密码库密码错误。本地未进行任何更改。</string>@@ -71,7 +62,6 @@     <string name="passkey_link_auto">自动匹配</string>     <string name="passkey_link_manual">由您关联</string>     <string name="passkey_link_detached">已断开连接。将不会自动匹配。</string>-    <string name="passkey_connect">关联到条目</string>     <string name="passkey_disconnect">取消关联</string>     <string name="passkey_link_use_auto">自动匹配</string>     <string name="passkey_link_dialog_title">关联到条目</string>