matrix-org / matrix-org/matrix-rust-sdk

Backup key warning spam in logs when key backups are unused

Open
#6,367 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

For bot clients, there is generally no reason to use key backups. With the e2e feature enabled, I get frequent warning messages in my logs:

```
WARN matrix_sdk_crypto::backups: Trying to backup room keys but no backup key was found
```

This warning is coming from `matrix_sdk_crypto::backups::BackupMachine::backup_helper`

https://github.com/matrix-org/matrix-rust-sdk/blob/3db476752362bab5a705b7d1c8caaaa1597eb987/crates/matrix-sdk-crypto/src/backups/mod.rs#L517-L521

Which if you follow up the call chain is being called by `matrix_sdk::encryption::backups::Backups::maybe_trigger_backup`

https://github.com/matrix-org/matrix-rust-sdk/blob/3db476752362bab5a705b7d1c8caaaa1597eb987/crates/matrix-sdk/src/encryption/backups/mod.rs#L1035-L1043

This is called unconditionally on every sync response

https://github.com/matrix-org/matrix-rust-sdk/blob/3db476752362bab5a705b7d1c8caaaa1597eb987/crates/matrix-sdk/src/sync.rs#L164

I'm not entirely sure what the intentions of this design are and don't have a good understanding of how key backups work in general, but I suspect there should be some point in this chain where we check whether backups are enabled before continuing.

Contributor guide

Open the contributing guide

Research direction

Start at crates/matrix-sdk/src/sync.rs, then follow Backups::maybe_trigger_backup in crates/matrix-sdk/src/encryption/backups/mod.rs to BackupMachine::backup_helper in crates/matrix-sdk-crypto/src/backups/mod.rs. Review how backup configuration is represented and determine where unused backups should stop the call chain. Done means bot clients without key backups no longer emit the repeated warning while configured backups still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.