You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
iOS: passphrase is interpolated unescaped into PRAGMA key / ATTACH ... KEY, and the stored passphrase uses the default Keychain accessibility #703
In 8.1.1 (iOS), the passphrase is interpolated directly into SQL string literals:
UtilsSQLCipher.swift: PRAGMA key = '\(password)'; and PRAGMA rekey = '\(newpassword)';
UtilsEncryption.swift: ATTACH DATABASE ... AS encrypted KEY '\(password)'; and PRAGMA key = '\(password)';
A passphrase containing a single quote breaks the literal — notably SQLCipher's raw-key form x'<64 hex>', which is the recommended way to pass a key derived elsewhere. Escaping ' as ''
(password.replacingOccurrences(of: "'", with: "''")) in those four statements fixes it.
Separately, KeychainServices.swift stores the passphrase without kSecAttrAccessible, so it gets
the default (kSecAttrAccessibleWhenUnlocked), which is included in encrypted device backups and
migrates to a new device. For a database key, kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
(set on add and on update, so existing items migrate) keeps it on the device.
We run both as a local patch; Android already uses EncryptedSharedPreferences over the Keystore and
needs no change. Happy to open a PR.
Activity