0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-19 19:42:19 +02:00
Commit Graph

1975 Commits

Author SHA1 Message Date
moiseev-signal
58f43107ab
Enforce Swift code formatting 2024-02-23 09:56:38 -08:00
Jordan Rose
4f4d21a8ca java: Mark all bridge_fns that return Result as throws Exception
Then, use FilterExceptions to filter out any exceptions that aren't
declared in the calling method's exception spec. Note that this isn't
perfect: Java's checks for typed exceptions prevents an *extra*
exception from being thrown this way, but it's still possible to
forget to *allow* an exception using FilterExceptions.

This is 99% a mechanical change; the interesting bit is in
gen_java_decl.py and one unusual pattern in NativeErrorsTest.java. No
exception specs were changed here.
2024-02-22 13:34:57 -08:00
Jordan Rose
8cd6f8c68c java: Add the FilterExceptions helper
These methods wrap any unexpected checked exceptions in AssertionError
after logging them. The next commit will use this to enforce our
exception specifications for methods that wrap JNI calls.
2024-02-22 13:34:57 -08:00
Jordan Rose
071adfc689 bridge: Distinguish Throwing and non-throwing JNI bridge_fns
This commit does not actually do anything with that information; that
will come next commit.
2024-02-22 13:34:57 -08:00
Jordan Rose
e115f69cd0 bridge: Make ProtocolAddress's getters infallible
The bridge_get! macro assumes every getter ought to be allowed to
fail, which isn't really correct but can be revisited later.
ProtocolAddress is simple enough to manually avoid that, though.
2024-02-22 13:34:57 -08:00
Alex Konradi
f30edf082f Add benchmark for poksho 2024-02-22 16:16:20 -05:00
Jordan Rose
77606128c2 Use the default SecureRandom generator for registration IDs
SHA1PRNG may have been more reliable in earlier versions of Android,
but that shouldn't be true anymore.
2024-02-22 12:26:51 -08:00
moiseev-signal
6f783269db
SVR3: JNI bridge 2024-02-22 12:22:10 -08:00
Alex Konradi
5b5b85e715
Expose CDSI lookup via FFI 2024-02-22 10:31:01 -05:00
Jordan Rose
4d5ae34c1a Make "endorsements" the name of the New thing, instead of "passes"
And demote the thing we called "pass" to a plain bag of bytes, like a
hash.
2024-02-21 18:09:45 -08:00
Jordan Rose
bcbba73917 bridge: Filter out log messages that aren't from libsignal 2024-02-21 15:16:46 -08:00
Jordan Rose
7b0ada80c5 usernames: Fix missing Cargo feature for curve25519-dalek
This was getting enabled by other crates in the build, but trying to
build something that *just* depended on this crate was failing.
2024-02-20 17:33:26 -08:00
Jordan Rose
6d8f559df8
Implement 3HashSDHI-based "passes" in zkcredential
(further tweaks to come)
2024-02-20 16:33:12 -08:00
moiseev-signal
c5537a98a5
Add .editorconfig 2024-02-20 10:26:38 -08: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
f980fccd8a Bump to version v0.40.1 2024-02-20 09:48:25 -05:00
Alex Konradi
0676a89c90
Build Swift docs in CI
Fix existing documentation issues. Prevent backsliding on documentation by 
requiring cross-links to be correct for CI checks to pass.
2024-02-16 17:14:03 -05:00
Alex Konradi
ac538311e9
Use failOnError instead of try! in Swift
Replace existing usages of try! with the failOnError helper. Add guidance to 
the coding guidelines doc.
2024-02-16 14:31:34 -05:00
Alex Konradi
1359b67486
Cache classes during initial Java library load
Use the class loader from the main thread to cache java.lang.Class
instances for some libsignal classes.

This enables constructing instances of libsignal classes on threads
where the classes aren't accessible via the default class loader. This
can occur on Android, where threads spawned via the native API only get
access to the system class loader, not the application loader that has
access to the application's class files. Since Tokio worker threads are
spawned via the native API, and the completion process for async tasks
converts results to Java objects, application class instances can't be
used there unless they are preloaded.

Since classes used in client code are only included in the client .jar
file, failure to load classes is a normal occurrence. If there are ever
separate builds for server and client .so library files, this could be
changed to a fatal error.
2024-02-16 10:38:12 -05:00
Alex Konradi
b8802028d8
Message backup validation cleanup 2024-02-15 17:53:03 -05:00
Alex Konradi
b85ec11255
Map Call.conversationRecipientId to RecipientId
Fix a bug in validation of the Call proto: the conversationRecipientId 
identifies a recipient, not a chat. Add a test case that only has a call with a 
recipient, not a chat.
2024-02-15 17:16:11 -05:00
Alex Konradi
8959e64ed1
Build TESTING_ functions for Android test
Run tests that call native TESTING_ functions on Android. This requires 
building a separate version of libsignal_jni.so with the testing functions 
included. The test code is still omitted from the published artifacts.
2024-02-15 16:53:05 -05:00
Alex Konradi
467b0f17b9
Add message backup validation negative tests
Add the ability to write tests that check error messages produced during
validation. Add a couple test cases.
2024-02-15 14:59:08 -05:00
Jordan Rose
786f5e9547 acknowledgments: "clarify" licenses that aren't properly recognized
Mostly just puts names next to copyrights for a few more crates.
2024-02-15 10:21:42 -08:00
moiseev-signal
37aa5fb323
ci: Upgrade actions to latest versions for Node 20.0 compatibility 2024-02-13 10:45:50 -08:00
Max Moiseev
7ef4efdb85 Bump to version 0.40.0 2024-02-12 12:03:40 -08:00
Alex Konradi
bd26a00b3e Clean cargo outputs before changing working dirs
Clean the contents of the default target directory before switching.
This should hopefully help us to avoid running out of disk space during
the following steps (running cross-version tests).
2024-02-12 14:06:26 -05:00
Sergey Skrobotov
22802cd22a libsignal-net: fix implementations for Arc<dyn ChatService> methods 2024-02-09 17:12:47 -08:00
Alex Konradi
100ce19945
Fix Java error handling for CDSI lookup
CDSI error handling code would attempt to instantiate a nonexistent Java class. 
Add the missing class and split up the handling for CDSI lookup errors to reuse 
existing error types.
2024-02-09 15:31:35 -05:00
Fedor Indutny
45d513a548
Introduce processMinidumpBuffer for Desktop 2024-02-09 09:46:55 -08:00
Jordan Rose
2077213e64 node: include the libsignal version in the node module file on macOS
This shows up in crash dumps (and RingRTC has been doing it for a
while).
2024-02-09 09:42:16 -08:00
moiseev-signal
bb7f178948
Check Java Strings for null when bridging 2024-02-08 16:59:51 -08:00
Jordan Rose
1827eb7780 java: DecryptionErrorMessage deserialization can InvalidKeyException 2024-02-08 15:43:35 -08:00
Jordan Rose
09abe004cc java: HsmEnclaveClient can fail at any point during the protocol 2024-02-08 15:43:35 -08:00
Jordan Rose
204ce07c21 java: Aes256GcmSiv.encrypt can't fail
More specifically, it can't throw an InvalidMessageException, and
IllegalArgumentException is a RuntimeException already.
2024-02-08 15:43:35 -08:00
Jordan Rose
55563113f4 bridge: DeviceTransfer_GeneratePrivateKey can't fail in practice
The device_transfer crate is very conservative about internal
failures, but there's nothing an app-level caller can do about such a
problem, so it might as well be subsumed in panic catching.
2024-02-08 15:43:35 -08:00
Jordan Rose
ad53b54901 bridge: Drop Result for some bridge_fns that can't fail in their bodies 2024-02-08 15:43:35 -08:00
Jordan Rose
77b5cf6b59 crypto: Remove Result type from infallible operations
And in the bridge layer, use panics instead of Result for the
programmer error of using an encryption/decryption stream after
finalization, eliminating the need for the InvalidState error.

(By "infallible operations", I mean operations which have no possible
failure according to the specification of their associated algorithm:
AES-CTR and AES-GCM are stream ciphers that can always operate on
arbitrary buffers.)
2024-02-08 15:43:35 -08:00
Alex Konradi
319f3e58b0
Make HMAC and hash algorithm methods infallible
Remove the Result types from the Rust functions that only every return Ok. 
Unwrap Result<T> return types for bridge functions that only ever return Ok.
2024-02-08 15:35:20 -05:00
Alex Konradi
483d220aba Expose CDSI debugPermitsUsed in app libs 2024-02-08 15:25:33 -05:00
Alex Konradi
bc0e4f31b9
Validate timestamps and convert durations
Check that timestamps in messages are within a reasonable range when converting 
them from milliseconds, logging if they're not. Convert duration values 
expressed in milliseconds into a native type.
2024-02-08 13:37:49 -05:00
Sergey Skrobotov
3198ebac66 libsignal-net: adding ChatServiceWithDebugInfo API and a disconnect function 2024-02-08 09:54:08 -08:00
Sergey Skrobotov
326811d575 libsignal-net: dropping http fallback from chat service 2024-02-06 10:26:05 -08:00
Alex Konradi
d08adf19bb
Return username candidates as string array
Use the string bridging code introduced previously to provide string arrays to 
client directly instead of joining and splitting. This eliminates the use of a 
magic ',' character as a delimiter.
2024-02-06 09:46:06 -05:00
moiseev-signal
826ddc5998
Implement a model-based integration test for SVR3 2024-02-05 14:08:08 -08:00
Alex Konradi
a628f0ec67 Fix Swift string array bridging slice bug
The Swift helper invokeFnReturningStringArray was using the wrong
indices when slicing up the concatenated strings to produce individual
values. Instead of advancing the base pointer by the N bytes read for a
given string, the base pointer was adjusted to point to LEN - N. This
wasn't detected by the bridging test case since it passed two strings
over, both of length three. For two strings with the same length, the
buggy and corrected code have the same behavior!

This patch adjusts the test case to include strings of different
lengths and fixes the now-revealed bug.
2024-02-05 17:00:47 -05:00
Alex Konradi
dfe82cd1eb
Validate call messages in message backup
Move existing validation into a TryFromWith impl on a dedicated type. Check 
that enum fields are not the UNKNOWN variants.
2024-02-05 11:16:36 -05:00
Alex Konradi
cf14d27f64
Check message backups for UNKNOWN enum values
For all enum types in backup.proto that have an UNKNOWN variant, check that 
fields of those types do not contain the UNKNOWN value. Add the minimum code 
necessary to traverse nested messages that were previously uninspected.
2024-02-05 10:26:51 -05:00
Alex Konradi
580913d225
Re-throw input stream errors in Swift and Java
Re-raise errors produced by an input stream after bubbling them through Rust 
code. This makes the interface less magic and avoids unnecessary 
stringification of error values.
2024-02-02 15:14:27 -05:00
Alex Konradi
11f7b0b231
Bridge message backup validation to node
Expose message backup at the bridge layer as a separate async function. Add a 
TS wrapper with the same interface as for the other app languages.
2024-02-02 14:47:05 -05:00