Repository navigation
Group keys and contact ids stay out of logs, file names, notifications and preferences - #176
Merged
Merged
Conversation
…s and preferences Chats get an opaque id: an HMAC of the chat id with a random key kept in projection.db. Logs, chat-picture file names and notification ids, threads and userInfo use it; every log line is scrubbed of service ids, phone numbers, keys and byte dumps, and libsignal-service's envelope-dumping decryption warnings are filtered out. Drafts move from UserDefaults into projection.db and go with their chat. Existing chat pictures are renamed at startup, safely across interruptions.
…mes chat pictures by opaque id
# Conflicts: # app/Hush/HushApp.swift
…hat's notifications and draft go, every log line and span is scrubbed and correlatable Drafts: every change is written and a failed write is shown; nothing is written until the drafts are read; they are read again after chat list changes; a chat's draft leaves the app only once the core deleted it; quitting waits for the last write; the move from the preferences keeps the core's copy and drops drafts of chats that aren't listed. Notifications: deleting a chat removes them; a click, reply or mark read naming a chat that's gone logs it, a click still brings Hush up, and a reply says the chat is gone; one constant for the userInfo key. Logs: libsignal-service's cipher warnings are back, scrubbed; span fields and byte fields are scrubbed too; decryption, retry, duplicate, unaccepted call and read receipt lines carry the chat's opaque id, and error texts name chats by it; sticker packs are named by a short tag. Chat pictures: a picture that can't be renamed is left for the next start and the others go on; missing ones are counted; files named by a chat that no chat points to are removed.
Owner
Author
|
Review fixes, in c0935ca (after merging origin/main, which had #175's conflict in Important
Suggestions taken
Declined
Checks
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
A group's chat id is
g:<hex master key>and a 1:1 chat's isc:<ACI>. Both reached places outside the encrypted databases. Now:projection.db(new tableinstall_key, migration 0029).ProjectionDb::opaque_id/Client.opaqueIdis HMAC-SHA256 of an id under that key, truncated to 8 bytes (16 hex characters). Without the database, nobody can reverse it or test it against a known ACI. It uses thehmac/sha2crates already in the tree.<aci>.1 not found", presage'sThread(contact=…),trusting new identitywith an address), goes through aScrublayer inlogging.rs. It blanks out UUIDs, hex runs of 32+ characters (keys),+phone numbers and decimal byte dumps.libsignal_service::cipheris filtered to errors only, so its envelope-dumping warnings are gone. Its error lines stay, scrubbed..private. Nothing there needed changing.avatar-<opaque id>-<time>. At startup,rename_avatars(which replacesreroot_avatarsand still handles a moved data folder) renames existingavatar-g-<key>-…/avatar-c-<aci>-…files and updates their rows. It renames first and updates the row second, so an interrupted run is finished by the next one. A picture whose file is gone is fetched again.threadIdentifieranduserInfocarry only opaque ids. A message's id is<opaque author>|<sentAt>|…, a reaction's adds<opaque reactor>|<emoji>, and calls usecall|<opaque chat>.projection.db:drafts, withClient.setDraft(blank text clears) andClient.drafts.draft.*keys in the preferences move into the core and are removed once stored. One that fails stays for the next launch.Backups and exports: drafts live in
projection.db, so they are in backups like messages and are restored with them. They are not in chat exports, which hold the messages only. The install key is backed up too, so restored chat-picture names stay valid.Desktop app: it keeps drafts in memory only and logs no ids. It shares the core's logging, so it gets the scrubbing too.
Why
With a master key and the group's encrypted state, anyone can read the group's title, members and picture. The unified log (as public text), file names, preferences and Notification Center's database all kept keys and ACIs, plus a timestamped record of who wrote when.
Closes #164
How it was tested
cargo test -p sig-corepasses: 501 passed, 3 ignored. New tests:Scrub: no ACI, PNI, key, phone number or byte dump gets through; error kinds, timestamps and opaque ids stay)make lintis clean (rustfmt, clippy-D warningson all targets includingcore/desktop, swift-format strict).origin/mainin a full run here:LegacyTests.testSettingsAreAdoptedWithoutOverwritingNewOnesand the on-screentestRightClickOnTextClickedIntoShowsTheMessageMenu. New tests:make desktop(a full GPUI build) wasn't run for disk space. Clippy type-checks it.