whisperfish / libsignal-service-rs

A Rust version of the libsignal-service-java library for communicating with Signal servers.
https://whisperfish.github.io/libsignal-service-rs/libsignal_service
GNU Affero General Public License v3.0
63 stars 28 forks source link

Crash when settings are changed right after fresh registration and linking a device #317

Open direc85 opened 4 weeks ago

direc85 commented 4 weeks ago

Observed with Whisperfish -- see https://gitlab.com/whisperfish/whisperfish/-/merge_requests/597

thread 'main' panicked at whisperfish/src/worker/client.rs:3409:18:
send configuration: UntrustedIdentity { address: ServiceAddress { uuid: MY-UUID, identity: AccountIdentity } }

Which in my case points to:

sender
    .send_configuration(&local_addr, configuration)
    .await
    .expect("send configuration");

Which, I believe, in turn comes from libsignal-service-rs sender.rs:

async fn try_send_message(...)
    // ...
    for missing_device_id in &m.missing_devices {
        // ...
        Err(ServiceError::MismatchedDevicesException(ref m)) => {
            // ...
            process_prekey_bundle(...)
                .await
                .map_err(|e| {
                    tracing::error!("failed to create session: {}", e);
                    MessageSenderError::UntrustedIdentity { // <-- here
                       address: recipient,
                    }
                })?;

So, uh, we don't trust ourselves at such early time? Perhaps we should trigger some session-creation actions after linking and/or registering...

dryo commented 1 day ago

I wanted to report the same, while I don't know what you mean by 'when settings are changed'. I just installed WF and linked a device. WF wanted to restart but it fails. That's all I did, IIRC.

direc85 commented 12 hours ago

The steps were:

gferon commented 7 hours ago

So, uh, we don't trust ourselves at such early time? Perhaps we should trigger some session-creation actions after linking and/or registering...

So, for a long time, Signal actually never sent messages to yourself aside from notes to self (which happened later in the process). It looks like you have found a nice bug to solve 😄