Skip to content

fix: reconcile stale broadcast channel name from QR invite#8251

Closed
bolstad wants to merge 1 commit into
chatmail:mainfrom
bolstad:fix/broadcast-channel-name-from-stale-qr
Closed

fix: reconcile stale broadcast channel name from QR invite#8251
bolstad wants to merge 1 commit into
chatmail:mainfrom
bolstad:fix/broadcast-channel-name-from-stale-qr

Conversation

@bolstad
Copy link
Copy Markdown

@bolstad bolstad commented May 16, 2026

Closes #8250

Problem

When a user joins a broadcast channel via a QR invite link
(https://i.delta.chat/#...), the joining device displays the channel
name taken from the link's b= parameter and never reconciles it
with the channel's actual name. If the two differ (e.g. the channel was
renamed after the link was generated, or an older link was shared), the
joining device shows the wrong name permanently — even after receiving
messages and membership events from the channel. Every other client
shows the correct name.

Root cause

  1. check_qr parses the link's b= parameter into
    Qr::AskJoinBroadcast { name }.
  2. On join, joining_chat_id() creates the local InBroadcast chat
    with that name via create_multiuser_record(); the chat's
    Param::GroupNameTimestamp is left unset (0).
  3. create_out_broadcast_ex() creates the owner's OutBroadcast chat
    without setting Param::GroupNameTimestamp. Channels are always
    promoted, so the first-message promotion path in chat.rs that sets
    the timestamp for Group | OutBroadcast is never reached.
  4. Consequently mimefactory emits Chat-Group-Name but never
    Chat-Group-Name-Timestamp for channel messages.
  5. apply_chat_name_avatar_and_description_changes() only enters the
    name-update block when the message carries a
    Chat-Group-Name-Timestamp (or Chat-Group-Name-Changed) header.
    With neither present, the QR-derived name is never overwritten.

Fix

  • create_out_broadcast_ex() now stamps Param::GroupNameTimestamp at
    channel creation, so every outgoing channel message advertises the
    name with a timestamp and joiners can reconcile a stale name.
  • Migration 153 backfills Param::GroupNameTimestamp on existing
    outgoing broadcast channels.

This keeps the "broadcast channels are always promoted" invariant
intact (Param::Unpromoted is untouched).

Testing

  • New regression test test_secure_join_broadcast_reconciles_stale_name
    joins a channel with a manipulated (stale) b= parameter and asserts
    the name is reconciled after a regular channel post. It fails without
    the chat.rs change and passes with it.
  • All existing broadcast tests pass, incl. test_broadcasts_name_and_avatar
    (which asserts channels are always promoted) and test_broadcast_change_name.
  • cargo fmt clean.

Disclosure

As my Rust knowledge is weak, I have created this patch with help of
Claude Code. Please take this under consideration when reviewing.

Outgoing broadcast channels (`Chattype::OutBroadcast`) were created
without `Param::GroupNameTimestamp`, so their outgoing messages never
carried a `Chat-Group-Name-Timestamp` header.

A member who joins a channel via a QR invite takes the channel name
from the invite's `b=` parameter (`joining_chat_id()` ->
`create_multiuser_record()`). Without a timestamp header on incoming
channel messages, `apply_chat_name_avatar_and_description_changes()`
skips the name-update block entirely, so that name is never reconciled
with the channel's actual name. The joining device then shows the name
embedded in the invite link forever, even though every other client
shows the correct name.

Stamp `GroupNameTimestamp` at channel creation in
`create_out_broadcast_ex()` so every channel message advertises the
name with a timestamp, and add migration 153 to backfill existing
outgoing broadcast channels.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bolstad
Copy link
Copy Markdown
Author

bolstad commented May 16, 2026

This is a fix for #8250

@bolstad bolstad closed this May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Channel name from an invite link's b= parameter is never reconciled with the channel's actual name

1 participant