Repository navigation
feat: store camera URLs encrypted with an Android Keystore key (part of #16) - #54
Conversation
PR Summary by QodoEncrypt stored camera URLs with an Android Keystore key
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
Code Review by Qodo
1. Android 5 devices still expose passwords
|
43fa9d3 to
6b9a2a4
Compare
Part of #16 (transport remains plain RTSP/HTTP): - CredentialStore seals each camera URL as "enc1:" + hex(IV + AES-256-GCM ciphertext) before it goes to SharedPreferences, and opens it on load. - KeystoreCipher keeps the key in the Android Keystore (Android 6.0+); it never leaves the Keystore. On Android 5.x, or if the Keystore fails, URLs are stored as before. - Plain URLs from older versions are re-saved encrypted on the first load. A value that cannot be decrypted (key gone, e.g. data restored to another device) leaves the slot unconfigured instead of crashing. - README (EN/RU/ZH): security notes updated; #16 now covers only the unencrypted transport. Tests: round trip with no password in the stored value, random IV, legacy plain values and their migration, another key / tampered / malformed values, no Keystore, null handling, hex helpers.
…ited If a sealed URL could not be opened (e.g. the Keystore was temporarily unavailable), its slot showed the placeholder, and saving any other camera wrote the placeholder over the encrypted value. The original stored value is now kept for such slots unless the user edits that slot.
RtspSessionTest iterated server.requests (a synchronized list) while the server thread was still appending, which threw ConcurrentModification- Exception now and then (failed once in CI on #54). Tests now read a copy taken under the list's lock.
6b9a2a4 to
feeb164
Compare
|
Device-tested (#53, run 4): after an upgrade from v2 the stored URLs are kept and migrated to |
RtspSessionTest iterated server.requests (a synchronized list) while the server thread was still appending, which threw ConcurrentModification- Exception now and then (failed once in CI on #54). Tests now read a copy taken under the list's lock.
feat: store camera URLs encrypted with an Android Keystore key (part of #16)
Part of #16. Transport stays unencrypted: RTSP and HTTP have no TLS, and RTSPS support would be a separate, larger task. #16 stays open for that.
How it works
CredentialStoreseals every camera URL before it goes toSharedPreferences:enc1:+ hex(IV + AES-256-GCM ciphertext with its tag). It opens the value on load.KeystoreCipherkeeps the key in the Android Keystore (Android 6.0+); the key never leaves it.README in all three languages: the security notes describe encrypted storage, and the #16 line in "Known limitations" now covers only the unencrypted transport.
Tests
CredentialStoreTest, 6 tests, using a JVM AES-GCM cipher with the same layout asKeystoreCipher:null; hex helpers.97 JVM tests on this branch (stacked on #48), all pass.
assembleDebugandlintDebugpass.Device checklist
adb shell run-as com.openipc.decoder cat shared_prefs/settings.xmlshowsenc1:…values with no passwords (debug build)