bug: Health tracking could temporarily get stuck if a remote's signing key expires during a backoff period #2318
Labels
No labels
Abandoned
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Compliance
Continuwuity/Web Interface
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
bob the builder
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
continuwuation/continuwuity#2318
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What is the bug?
Continuwuity's remote health tracking intercepts any federation request that is made to a remote that may be unhealthy (in backoff). It resets this status under any of two conditions:
However, the universal request interception is a detriment here. If a server is in a backoff period at the time of making an authenticated federation request, AND the latest copy of the signing key we had for it expired BEFORE the request was made, the attempt to fetch fresh signing keys from the remote will fail, as it will be intercepted by health tracking.
This does not result in a lockup or anything, but does mean that such remotes will have to wait out the entire backoff period before being able to federate with us again, rather than breaking the backoff period early by making a successful request
Steps to reproduce
b.examplefroma.example, signed with a key that expires in 30 secondsb.exampleofflineb.exampleona.example(e.g. fetching profiles). This causesa.exampleto actively back off fromb.exampleb.exampleback online after a few minutes (to ensure enough of a backoff window has accrued ona.example)a.examplefromb.examplea.examplewill attempt to fetch a fresh key set forb.example, but the request will be bounced by health trackingServer name and version
N/A (
d83da6ada7)Additional context
let key = services.server_keys.get_single_verify_key(&output.origin, &output.key, min_valid_ts).await.ok_or_else(|| {err!(Request(Unauthorized(debug_warn!(origin=%output.origin,"Unable to acquire your signing key (ID: {})",output.key))))})?;let keys: PubKeys = [(output.key.to_string(), key.key)].into();let keys: PubKeyMap = [(output.origin.as_str().into(), keys)].into();match output.verify_http_request(request, destination, &keys) {| Ok(()) => {if services.moderation.is_remote_server_forbidden(&output.origin){return Err!(Request(Forbidden("You are blocked from federating with this server.")));}// Ping the server as healthyif services.federation.mark_healthy(&output.origin) {services.sending.flush_servers([output.origin.clone()].stream()).await.ok();}speak of the devil: chaos-ex.chat just migrated from Synapse to Continuwuity, and found that no servers were willing to federate with them due to the need to acquire the new signing key, but being unable to due to the backoff accrued during the migration period.