0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-20 03:52:17 +02:00
Commit Graph

74 Commits

Author SHA1 Message Date
Jordan Rose
03b71fea23 backup: Validate quoted attachments 2024-08-02 09:39:02 -07:00
Jordan Rose
f2b9ad59d5 backup: Validate GroupMemberAddedUpdate.inviterAci more specifically 2024-08-02 09:38:48 -07:00
Jordan Rose
7fa901aa14
backup: Validate FilePointers and MessageAttachments 2024-08-01 14:41:57 -07:00
Jordan Rose
3e064082f3 backup: Validate e164s (they must not be 0) 2024-07-31 11:28:49 -07:00
Jordan Rose
85e0de9207
Update Rust dependencies
`cargo update` performed with Cargo 1.72 to avoid advancing our MSRV. assert_cmd, clap, protobuf, and protobuf-json-mapping needed to be manually held back.

Plus, explicit bumps for
- env_logger 0.11
- heck 0.5
- itertools 0.13
- num_enum 0.7
- prost 0.13
- tungstenite 0.23

And disallowing downgrading curve25519-dalek below the security update in 4.1.3.
2024-07-25 13:33:09 -07:00
Alex Konradi
a6a8eae650
Fix expected canonical test case output 2024-07-16 15:40:43 -04:00
Alex Konradi
f6acd4f98d
Update backup.proto to latest version 2024-07-16 14:20:53 -04:00
Alex Konradi
66cd3f0133
backup: bridge canonical serialization as ComparableBackup 2024-07-16 14:20:31 -04:00
Alex Konradi
535241d423
backup: add canonically-serializable type
Add a type with a canonical serialized form that, for the same logical backup 
contents (even with frame reorderings), will always serialize to the same value.
2024-07-15 14:48:59 -04:00
Alex Konradi
784164d4bb
backup: Make message backup types serializable 2024-07-12 15:20:25 -04:00
Alex Konradi
eb0a8ef60e
Update to latest backup.proto definition
Notable changes:
- custom colors are now referenced indirectly
- SimpleChatUpdate changes w/ new test cases
2024-07-11 15:01:50 -04:00
Alex Konradi
7af57ad1dd
backup: make recipient type vary with method
This replaces the recipient ID, which is a weak logical reference to external 
data, with one of two types, depending on the mode. For streaming validation, 
only the minimal data is kept. For validation via the CLI or (soon) for 
canonicalization, the full data is kept behind an Arc.
2024-07-10 17:07:34 -04:00
Alex Konradi
4cce5633d1
Avoid calling AsyncRead::read with empty target 2024-06-28 10:11:57 -04:00
Alex Konradi
fc4e1dbcd6
Switch to JSON5 for backup .jsonproto parsing 2024-06-26 15:35:40 -04:00
Alex Konradi
b064ec78c5
Upgrade rustc to latest nightly 2024-06-25 11:31:59 -04:00
Alex Konradi
aeeba5e676
Track ad-hoc calls in message backups 2024-06-21 13:21:25 -04:00
Jordan Rose
44ff1e74e6 Update to a slightly newer rustc 2024-06-20 12:04:44 -07:00
Alex Konradi
66436b7c48
Remove unused dependencies 2024-06-18 16:05:21 -04:00
Alex Konradi
24c234a5fe
Update message backup proto definition 2024-06-13 15:37:26 -04:00
Alex Konradi
408e470724
backup: Track order of all chat items across chats 2024-06-11 10:54:35 -04:00
Alex Konradi
53d60eb968
backup: make validation completion fallible 2024-06-07 09:31:55 -04:00
Alex Konradi
6e492fcfa7
backup: validate distribution list, record group fields 2024-06-06 17:43:02 -04:00
Alex Konradi
83daebf72d backup: pull latest backup.proto definition, tests
Notable changes:
- subscription refactor, add backup subscription data
2024-06-06 15:28:53 -04:00
Alex Konradi
12f886bff0
backup: prepend IV in example binary 2024-06-04 09:49:40 -04:00
Alex Konradi
228eca8a6b
backup: Update backup.proto to latest version 2024-05-31 14:22:13 -04:00
Alex Konradi
0cf9d20e21
backup: track more message backup fields 2024-05-30 11:17:38 -04:00
Alex Konradi
31d6015522
backups: add shared message backup test cases 2024-05-24 15:59:44 -04:00
Alex Konradi
18f35aa316
Treat subscriber ID and currency as optional 2024-05-24 11:42:49 -04:00
Alex Konradi
f015765008
Import backup proto definition
Notable changes:
- addition of chat styles
2024-05-24 08:59:53 -04:00
Alex Konradi
eb63e3037c
Import latest backup proto definition
Notable changes:
- addition of payment notifications
2024-05-22 15:25:05 -04:00
Alex Konradi
b81c6393ff
Split up backup/chat.rs
Move code for various categories of messages into their own modules. This is a 
functional no-op.
2024-05-22 10:47:20 -04:00
Alex Konradi
c4917d6329
Track values in chat-related protos
Validate some missed values from chat protos and retain the values in-memory 
for use in the backup comparator.
2024-05-22 10:02:55 -04:00
Alex Konradi
f18b39f5b0
Revert "Move message backup proto and I/O to new crate"
This reverts commit 55536686be.
2024-05-20 16:50:03 -04:00
Alex Konradi
3e1c50a4d5
Keep all message backup account data and call fields during validation
When converting account data and call-related protobuf messages into in-memory 
forms, retain the values of all fields instead of discarding some. This is the 
first step in making it possible to compare the in-memory versions of backups 
for testing.
2024-05-20 16:17:17 -04:00
Alex Konradi
38092e9ab0
Update backup proto from specs
Major changes:
- addition of call links
- split of Call message into IndividualCall, GroupCall, AdHocCall
- moving AdHocCall back to top-level frame type
2024-05-20 10:31:37 -04:00
Alex Konradi
4f630a60f4
Stop tracking call IDs in message backups
Call identifiers are not required to be unique across a client, and unlike chat 
IDs and recipient IDs, call IDs are not used as foreign keys elsewhere in a 
backup file. Calls shouldn't be checked for uniqueness and therefore don't need 
to be tracked at the top level.
2024-05-17 10:39:58 -04:00
Alex Konradi
55536686be
Move message backup proto and I/O to new crate
Add a new crate, libsignal-message-backup-io, and move the existing code that 
handles backup decryption, deframing, and protobuf deserialization there. Keep 
the actual validation of the protobuf contents in the libsignal-message-backup 
crate.

This allows the existing example binproto<->json binaries to be built with 
local modifications to the backup.proto file without also requiring all the 
validation code to be modified.
2024-05-15 14:10:53 -04:00
Alex Konradi
145d6fee9c
Update message backup proto from specs 2024-04-17 14:06:42 -04:00
Alex Konradi
6114bb7962
Use the first bytes of a backup as the AES IV
Treat the first 16 bytes of the stream as the IV for the AES block cipher. This 
is incompatible with the previous scheme, where the IV was derived from the 
master key.
2024-04-15 16:37:46 -04:00
Alex Konradi
0904a624dd
Handle padding in encrypted message backup
Handle encrypted & compressed message backup files with additional padding 
after the compressed contents (the padding bytes are encrypted, but not 
compressed). Update the example encrypter binary to add padding by default.
2024-04-11 16:01:52 -04:00
Alex Konradi
9b34467614
Use taplo to auto-format TOML files
Use https://github.com/tamasfe/taplo to auto-format TOML files. Add a config 
file to force reordering of dependencies in Cargo.toml files. Run taplo in CI 
to check formatting.
2024-03-26 16:06:45 -04:00
Alex Konradi
28fe15ee91
Import latest backup proto changes
Keep up with field renumberings and remove references to removed fields.
2024-03-26 14:36:45 -04:00
Alex Konradi
5ef3a7504d
Import latest message backup proto definition 2024-03-21 14:07:20 -04:00
Alex Konradi
fe506b48b2
Improve error message for CLI hex bytes parsing
Include # of bytes in addition to # of hex digits.
2024-03-08 14:48:43 -05:00
Alex Konradi
228892c8c7
Update message backup proto definition
Pull in the latest changes from the specification and adjust code to 
accommodate.
2024-03-04 13:24:35 -05:00
Alex Konradi
274b680ef4
Expose message backup purpose as an argument
Add a flag to the CLI validation tool and an argument to the bridged validation 
functions so users can specify whether a provided message backup should be 
validated according to the rules for device-to-device transfers or backups 
intended for remote storage.
2024-03-01 09:53:00 -05:00
Alex Konradi
b1e996d3c3
Disallow messages that are expiring soon
Reject backups that include expiring messages that are expiring soon or have 
already expired.
2024-02-29 17:01:58 -05:00
Alex Konradi
e571290a56
Check the HMAC after validating contents
Prevent a TOC/TOU bug by checking the MAC of the backup reader before 
validating contents, and then again after reading the contents. This makes sure 
that if the file contents change between the first and second read, that will 
be detected.
2024-02-28 16:22:33 -05:00
Alex Konradi
20e8fb23e6 Improve error messages for empty oneofs
Point to the offending oneof by name in error messages.
2024-02-20 13:22:11 -05:00
Alex Konradi
b8802028d8
Message backup validation cleanup 2024-02-15 17:53:03 -05:00