Include banned and invited servers in event destination set

Aperta
#388 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@ggazzo ci sta già lavorando.

Dal 27/3/2026.

  • #390 di @ggazzo — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
typescript

Direzione di ricerca

Inizia da StateService.getServerSetInRoom e segui come sendEventToAllServersInRoom costruisce le destinazioni per gli eventi di ban e unban. Confronta il filtro attuale dei membri con il comportamento dei resident server di Matrix descritto qui, quindi verifica che un ciclo di ban/unban recapiti l’evento intermedio di leave e consenta di elaborare il successivo invito senza un errore di stato mancante.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

type: bug

Problem

getServerSetInRoom (in StateService) only includes servers that have at least one user with membership: 'join'. When a user is banned, their membership changes from join to ban. If they were the only user from their server, that server is excluded from the destination set for subsequent events — including the unban event.

What happens today
  1. Server A bans a user from Server B
  2. Ban event is sent to Server B (user still had join when server set was computed)
  3. Server B processes the ban, membership updates to ban
  4. Server A unbans the user (sends membership: leave via kickUser)
  5. sendEventToAllServersInRoom computes the server set — Server B has no join members → excluded from destinations
  6. The leave (unban) event is never delivered to Server B
  7. Server A tries to re-invite the user — builds an invite whose prev_events reference the leave event
  8. Server A sends the invite to Server B via /v2/invite
  9. Server B has m.room.create (user had previously joined), so processInvite calls handlePdu
  10. handlePdu → _resolveStateAtEvent → looks for stateId of prev_events → the leave event was never received → "no previous state for event" error
  11. Invite processing fails, Server A gets a 500
Impact
  • After a ban+unban cycle in a federated room, the user cannot be re-invited
  • The state chain on the remote server becomes broken because intermediate events are missing
  • Affects RC ↔ RC federation. RC ↔ Element (Synapse) works because Synapse handles server routing differently
Root cause

The Matrix spec states that servers should continue receiving events for rooms where they have any membership state (join, invite, ban, leave with prior membership). Our getServerSetInRoom only considers join membership, which is too restrictive.

Proposed fix

getServerSetInRoom should include servers that have users with ban or invite membership in addition to join. A banned user's server still needs to receive room events (at minimum the unban event) to maintain a consistent state chain.

From the spec perspective, the set of servers that should receive events ("resident servers") includes any server with at least one user with membership join or invite. For ban, the server should receive at minimum the events needed to transition out of the banned state.

Simpler alternative: when sending a ban-related event (membership: leave after ban), explicitly add the target user's server to the destination set regardless of their current membership.

Lingua principale
TypeScript
Stelle
17
Fork
18
Merge medio
2h 11m
PR unite (30g)
2

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di RocketChat/homeserver

Tutte le issue di RocketChat/homeserver

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.