Commit Graph

551 Commits (9513e90a84d4527b0a8434e0b5c73886fa85566a)

Author SHA1 Message Date
Scott Nonnenberg 1e694fe8d7 Log entry max to 2k, remove logging in hot codepaths (#1459)
On a recent trip through a CPU profile taken while Signal Desktop
churned through a large backlog of messages, it was clear that
console.log was a major source of time spent, primarily the sort
operation required after every new entry is added to the Backbone
collection. So, three different techniques to combat this:

1) Reduce the maximum number of entries in the collection from 5k to 2k
2) No more logging of add/update/remove queue in MessageReceiver
3) No more log entries in Message.handleDataMessage main codepath

FREEBIE
8 years ago
Lilia 51cd28bb4a Fix race handling contact sync with verified info (#1419)
When processing a contact sync with embedded identity key verification info, we
were running overlapping async fetch/save operations on the same conversation
model, causing a race that tends to clobber updates to the contact info.

In this change we extend the application-level contact info handler to block on
a subsequent call to the verification handler, which effectively serializes the
fetch/save calls, and relieves the need for the message receiver to trigger a
seperate event concerning the verification info on contact sync messages.

Fixes #1408

// FREEBIE
8 years ago
Scott Nonnenberg 36e8b82b5f Remove unknown group messages from cache - no need to retry! (#1414)
FREEBIE
8 years ago
Scott Nonnenberg 46b64e306f createTaskWithTimeout: Don't log expiration if task threw (#1412)
FREEBIE
8 years ago
Scott Nonnenberg 4011e26b50 Fix handling of sync message with blocked numbers (#1411)
FREEBIE
8 years ago
Scott Nonnenberg c0cd733139 Full export, migration banner, and full migration workflow - behind flag (#1342)
* Add support for backup and restore

This first pass works for all stores except messages, pending some scaling
improvements.

// FREEBIE

* Import of messages and attachments

Properly sanitize filenames. Logging information that will help with
debugging but won't threaten privacy (no contact or group names),
where the on-disk directories have this information to make things
human-readable

FREEBIE

* First fully operational single-action export and import!

FREEBIE

* Add migration export flow

A banner alert leads to a blocking ui for the migration. We close the socket and
wait for incoming messages to drain before starting the export.

FREEBIE

* A number of updates for the export flow

1. We don't immediately pop the directory selection dialog box, instead
  showing an explicit 'choose directory' button after explaining what is
  about to happen
2. We show a 'submit debug log' button on most steps of the process
3. We handle export errors and encourage the user to double-check their
  filesystem then submit their log
4. We are resilient to restarts during the process
5. We handle the user cancelling out of the directory selection dialog
  differently from other errors.
6. The export process is now serialized: non-messages, then messages.
7. After successful export, show where the data is on disk

FREEBUE

* Put migration behind a flag

FREEBIE

* Shut down websocket before proceeding with export

FREEBIE

* Add MigrationView to test/index.html to fix test

FREEBIE

* Remove 'Submit Debug Log' button when the export process is complete

FREEBIE

* Create a 'Signal Export' directory below user-chosen dir

This cleans things up a bit so we don't litter the user's target
directory with lots of stuff.

FREEBIE

* Clarify MessageReceiver.drain() method comments

FREEBIE

* A couple updates for clarity - event names, else handling

Also the removal of wait(), which wasn't used anywhere.

FREEBIE

* A number of wording updates for the export flow

FREEBIE

* Export complete: put dir on its own line, make text selectable

FREEBIE
8 years ago
Scott Nonnenberg 9fb079253c Remove errors from the cache when they are shown to the user (#1392)
There's really no reason to retry encryption errors again if they've
already been made user-visible in a conversation.

Also, refactor e->error in background.js onError(), since both e and ev
in this method made it too easy to make a mistake.
8 years ago
Scott Nonnenberg 84fd605ad3 MessageReceiver cache: Don't convert to string for save
Because IndexedDB supports ArrayBuffer natively.

FREEBIE
8 years ago
Scott Nonnenberg 4ef36cc95c Add logging to help track down problems with Sync
Seems like we're running into errors sending the message to kick off the
sync, so positive logging as well as error logging is included.

FREEBIE
8 years ago
Scott Nonnenberg 7e9ed1481b Set receivedAt after decrypt, sort by received then sent
FREEBIE
8 years ago
Scott Nonnenberg 620b71a649 Maintain original received time when processing queued/error msgs
FREEBIE
8 years ago
Scott Nonnenberg 8700112f6d Decrypt any IncomingIdentityKeyError still sticking around
FREEBIE
8 years ago
Scott Nonnenberg b33c5c4c07 MessageReceiver: Wait for all code paths in handleSyncMessage
Without this, the recent changes to wait for read receipts and delivery
receipts don't have much of an effect.

FREEBIE
8 years ago
Scott Nonnenberg 2130795708 Fix 'retry message' scenario: they are now content messages
FREEBIE
8 years ago
Scott Nonnenberg e0c1f0d27a MessageReceiver: Process cached before dismissing loading screen
FREEBIE
8 years ago
Scott Nonnenberg fa00f08c95 MessageReceiver: Fix envelope id logging and make it consistent
FREEBIE
8 years ago
Scott Nonnenberg 7e8f3ab5e7
Fix for "Can't find record for undefined.1"
Also, we didn't need to recalculate the number here anyway!

FREEBIE
8 years ago
Scott Nonnenberg e223db56d9 Set messageKeysLimit to unlimited if communicating with our devices (#1348)
Set messageKeysLimit to unlimited if communicating with our devices

FREEBIE
8 years ago
Scott Nonnenberg 7d4ae63501 MessageReceiver: Log empty event, flow promise properly
FREEBIE
8 years ago
Scott Nonnenberg 92ba295d52 Better logging for sync sent messages, and new (disappeared) msgs
FREEBIE
8 years ago
Scott Nonnenberg 0b4d14e5ac MessageReceiver: Ensure that we queue all cached first
FREEBIE
8 years ago
Scott Nonnenberg 73a77c7b97 Consistent returns, no more eventTarget, comments for tricky bits
FREEBIE
8 years ago
Scott Nonnenberg 8c231d9830 MessageReceiver: Flow promises back properly in decrypt error case
FREEBIE
8 years ago
Scott Nonnenberg af2ce56c8d Reset MessageReciever queue whenever possible
(like we do with the conversation queue already)

FREEBIE
8 years ago
Scott Nonnenberg 305bd6b3b8 App loading screen: show messages processed so far
Also, show the same loading screen on index.js before we've bootstrapped
the app.

FREEBIE
8 years ago
Scott Nonnenberg 53f2bfbb57 Animated loading screens on startup and first conversation load
FREEBIE
8 years ago
Scott Nonnenberg f38d715250 Read receipts: Log sender and timestamp when related msg not found
FREEBIE
8 years ago
Scott Nonnenberg 9db0a58260 Whenever adding something to a queue, include a timeout
No more wedged queues!

FREEBIE
8 years ago
Scott Nonnenberg bd0050b6c6 Cache messages on receipt, remove from cache when processed
FREEBIE
8 years ago
Scott Nonnenberg 20451cc827 Show verified/keychange notifications when actually relevant
FREEBIE
8 years ago
lilia 982e7f962c Update libsignal-protocol
// FREEBIE
8 years ago
Scott Nonnenberg 224140c911 OutgoingMessage: Provide proper timestamp for replayability
FREEBIE
8 years ago
Scott Nonnenberg 5d1150e5bc Fix call to reloadDevicesAndSend - it returns a function
FREEBIE
8 years ago
Scott Nonnenberg f414c13220 Protos: Update to optional verified in sync (was: repeated)
This means that we no longer need to iterate.

FREEBIE
8 years ago
lilia fdce4cfc7c Fix failed identity key sync from contact sync
These were failing because ByteBuffers from the protobufs need to be converted
to ArrayBuffers. Fixed by useing the existing handler in MessageReceiver to
process verified messages from contact sync messages and dispatch them as their
own events, reducing some complexity on the application side.

// FREEBIE
8 years ago
Scott Nonnenberg 4ee4ad80c3 Message.send - check for missing identityKey, also add logging
FREEBIE
8 years ago
Scott Nonnenberg 551aa24e9a OutgoingMessage: A few code style tweaks to make things readable
FREEBIE
8 years ago
Scott Nonnenberg 116e4d2eeb OutgoingMessage: Reduce the calls to registerError
In some cases, due to promise chaining and error propagation, we were
calling registerError more than once for a given error. This would then
cause the overall callback for the send operation to be called with a
partial set of errors, as well as duplicates.

Note: we do need to find a way to attach identityKey to the
OutgoingIdentityKeyError in the case where it comes directly from the
encrypt() instead of our pre-key operations.

FREEBIE
8 years ago
lilia 9f4fcc5afa Send null messages to mask verified syncs
First construct a null message of random size and contents and send it to the
destination. Then include that same padding in the verification sync.

Note that the sync message is additionally randomly padded like all other sync
messages.

This lets Verified sync messages appear the same as normal sync message traffic.

// FREEBIE
8 years ago
lilia bb9c97b960 Support for receiving null messages
Just log em for debugging. Also update the error messge thrown when we get a
content message with no supported properties. It may be empty or may just have
an unrecognized field.

// FREEBIE
8 years ago
lilia 1e93b12b90 Update protos with support for null messages
// FREEBIE
8 years ago
lilia 6e758fc1ea Randomly pad all sync messages
WhisperSystems/libsignal-service-java@c46cdc0aa5

// FREEBIE
8 years ago
Scott Nonnenberg 20f4d48991 Protos: Move to latest iteration of verification protos
FREEBIE
8 years ago
lilia 4232f5711c Handle identity key change errors on encrypt
We need to capture key change errors from the protocol library when we call
encrypt. Previously we would only see these on session init.

// FREEBIE
8 years ago
Scott Nonnenberg 4a1dc46ab3 Fixes to get local verification and sync messages working
FREEBIE
8 years ago
lilia 52481d1d13 Support for sending and receiving verification sync messages
This adds a new method to message sender for sending verification sync messages
and a new event to message receiver representing incoming verification sync
messages. Currently the event handler just logs the message.

// FREEBIE
8 years ago
lilia 261ec003ee Account manager calls saveIdentityWithAtttributes
saveIdentityWithAtttributes allows directly setting all properties of an
identity key record. In AccountManager we use it to save our own identity
key after a new registration.

Previously we would remove the existing key first in order to coerce firstUse to
true, but now we can simply set it explicitly, along with a VERIFIED status.

// FREEBIE
8 years ago
lilia 53e7e1be3a Fix libsignal-protocol using wrong direction flag
// FREEBIE
8 years ago
lilia 6fdd0f1625 Handle identity errors on decrypt
Previously we only expected these errors to occur when decrypting prekey
messages, so we need to add handling for them in the case of a normal message.

// FREEBIE
8 years ago
lilia 2584f4fae4 Fix tests
// FREEBIE
8 years ago
lilia f095a1583e Fetch profiles whenever conversations are opened
For a group, fetch everyone's profile.

// FREEBIE
8 years ago
lilia d295fa7057 Update libsignal-protocol
// FREEBIE
8 years ago
lilia 4e4aedd4ba Pass in non/blockingApproval args to saveIdentity
Multiple cases here:
1. setting our own key on registration
1. changing identities from a safety number change dialog

Note that removeIdentityKey runs before saveIdentity, so we'll always end up
with firstUse: true on our own key.

// FREEBIE
8 years ago
lilia 22e907a8d4 Add getProfile to MessageSender
// FREEBIE
8 years ago
lilia 0c5a69cce4 Add support for getProfile to TextSecureServer
// FREEBIE
8 years ago
lilia 3afe378063 Remove legacy property from OutgoingMessage 8 years ago
lilia d47ced1199 Don't recompute outgoing message padding
We can use the same padded plaintext across multiple numbers or attempts rather
than re-creating it every time we encrypt to a particular number.

// FREEBIE
8 years ago
lilia 30201969be Inline some functions in OutgoingMessage
Since we no longer have legacy messages to send, we can simplify things a bit
here.

// FREEBIE
8 years ago
lilia e8548879db Stop sending legacy DataMessages 8 years ago
lilia cc4d2993d1 Remove out of date test
This test is out of date with respect to the latest signed key rotation rules
implemented in b92dd45 and 536dd7b. Previously we would only keep the last two
signed keys, but now we keep at least three as well as requiring a minimum
retention period. As a result, this test should be failing, but we haven't
noticed because it's not using the `done` parameter to signal its asynchronous
nature.

// FREEBIE
8 years ago
lilia 89a7875747 Remove unused function
This was supposed to solve the problem of losing group state after a reinstall
by inspecting member registration ids and pre-emptively sending group updates to
those who appear newly re-registered, but it has been unused since 6123c419.

Nowadays there's a protocol for requesting lost group state from other members.

// FREEBIE
8 years ago
lilia 4842ef6153 Sync end session messages
// FREEBIE
8 years ago
lilia 6c53605dfd Flag voice note attachment protos as such
// FREEBIE
8 years ago
lilia 6b531ad342 Fix attachment size
This is already a number.

// FREEBIE
8 years ago
lilia 27a1c9f18a Populate attachment file size
// FREEBIE
8 years ago
lilia fc514aa96f Add support for attachment file names
Send, receive, and save attachment filenames. Use them as suggested
names when saving files.

// FREEBIE
8 years ago
lilia a256f17e19 Cleanup attachment attributes
Convert attachment ids from longs to strings, and byte buffers to
arrays.

// FREEBIE
8 years ago
lilia dcfc4701c2 Tweak socket event logging 8 years ago
lilia 26d97e621b Update libsignal-protocol 8 years ago
lilia a72c2968f2 Handle unknown request types
// FREEBIE
8 years ago
lilia d1114edcd4 Update libsignal-protocol-javascript 1.1.10
// FREEBIE
8 years ago
lilia 611bbaef35 Don't hardcode the attachment server url
There may come a day when we may need to change this url from the server
side. On that day, clients should continue to operate normally. The
service should be able to change attachment server locations without
requiring a client update.

// FREEBIE
8 years ago
lilia 43de0cc2ec Add attachment digests
// FREEBIE
8 years ago
lilia f1a1a819ba Stop parsing attachment ids from attachment urls
See 2111294

Attachment ids are now available in string form from the server
response to `putAttachment`.

// FREEBIE
8 years ago
lilia 280f7a74b1 Fix key change errors while retrying key change errors 8 years ago
lilia e1662f8537 Drop unneeded binds
There are no references to `this` in these functions.

// FREEBIE
8 years ago
lilia 7cbaac5590 Provisioning socket events don't block AccountManager tasks
// FREEBIE
8 years ago
lilia 38a830c561 Fixup account manager task queue
Such that it still pumps tasks if one of them throws/rejects.

// FREEBIE
8 years ago
lilia 51131df23b Update libsignal-protocol-javascript 1.1.9
// FREEBIE
8 years ago
lilia 0fac2e1d68 Log when we see a 0 registrationId
Most likely an indicator that the device we're dealing with is a 3rd
party client.

// FREEBIE
8 years ago
lilia 4e21e783db Fix tests 8 years ago
lilia b92dd45a22 Add signed key rotation and deletion routines
// FREEBIE
8 years ago
lilia cd0fe7037b Add replayable error for signed key failure
Disable message sending if signed key updates fail too many times, but
allow the user to retry sending.

// FREEBIE
8 years ago
lilia 37ad742ccf Support for server endpoint to set signed key 8 years ago
lilia dfc292ac70 Serialize prekey refreshes & other account mgmt
Fixes #1060

// FREEBIE
8 years ago
lilia f0f6bbb8c0 Update libsignal-protocol 1.1.8
// FREEBIE
8 years ago
lilia 819ba8ee74 Support for undefined preKey 8 years ago
haffenloher d2ddfc72e4 Throw UnregisteredUserErrors in getKeysForNumber() 8 years ago
lilia 053bf20185 Group updates never have body or attachments
Why would they? And group.added isn't used anywhere else.

// FREEBIE
8 years ago
haffenloher 04f0142b23 Ignore missing members in incoming group updates
Previously, updateNumbers would throw an Error, so the whole group
update was discarded.

Signal-Android handles this the same way in
GroupMessageProcessor.handleGroupUpdate().

Closes #1056
8 years ago
lilia 7e06e014c4 Add debug logging for #1030
// FREEBIE
8 years ago
lilia 73e69fe5eb Update libsignal-protocol 1.1.7 9 years ago
lilia 7c81e4ed2e Delete extra space 9 years ago
lilia 02ca0a09ac Remove dead code 9 years ago
lilia d52050d43f Fix group timer updates 9 years ago
lilia 1da44c847b Fix handling sent messages sans expirationStartTimestamp 9 years ago
lilia 86dbbc9f29 Allow null expireTimer in sendmessage 9 years ago
lilia 7eea88a545 Convert expirationStartTimestamp to number 9 years ago
lilia ad2174e279 Sync expirationStartTimestamp on outgoing messages
Linked devices need to know when to start the clock.
9 years ago
lilia 6074a29046 Send timer update messages when changing the timer 9 years ago