dendrite icon indicating copy to clipboard operation
dendrite copied to clipboard

Rejected Join Event for Public Rooms

Open timaeos opened this issue 2 years ago • 3 comments

Background information

  • Dendrite version or git SHA: 0.9.6+0d697f67
  • Monolith or Polylith?: Monolith
  • SQLite3 or Postgres?: Postgres
  • Running in Docker?: No
  • go version: 1.18.5
  • Client used (if applicable): Element Desktop

Description

  • What is the problem: The dendrite server is rejecting some events that should appear to be allowed.
  • Who is affected: Users that dendrite doesn't see as in a room but that are actually in a room.
  • How is this bug manifesting: Message and Join events are displaying as rejected even though the room is public. See below snippet from the logs showing a leave to join rejected event despite the room being public and not having an invitation requirement.
  • When did this first appear: It's unclear -- I believe this has been around for a while but definitely visible in the latest main

Steps to reproduce

  • Join a public room with a synapse server account and with a dendrite server account
  • confirm that there is a difference in membership between the two accounts for users
  • have a user that doesn't appear in the dendrite instance attempt to speak
Sep 07 10:02:07 hermes dendrite-start.sh[2182468]: time="2022-09-07T15:02:07.935965944Z" level=warning msg="Stored rejected event" context=missing error="eventauth: \"@harukotanooki:matrix.org\" is not allowed to change their membership from \"leave\" to \"join\" as join rule \"invite\" forbids it" event_id="$Zuy_-kmk17mjNvMpA0wa0CslY9RywrBADfCwwKxLM7Q" kind=KindNew origin=matrix.org room_id="!zAeWUNBoXONgkVtgqn:mozilla.org" type=m.room.member
Sep 07 10:02:07 hermes dendrite-start.sh[2182468]: time="2022-09-07T15:02:07.936060681Z" level=warning msg="Roomserver rejected event" error="eventauth: \"@harukotanooki:matrix.org\" is not allowed to change their membership from \"leave\" to \"join\" as join rule \"invite\" forbids it" event_id="$Zuy_-kmk17mjNvMpA0wa0CslY9RywrBADfCwwKxLM7Q" room_id="!zAeWUNBoXONgkVtgqn:mozilla.org" type=m.room.member

The dendrite server appears to not see the user in the room and rejects the event of leave to join despite the room being noted as a public room. For the record, the room in question is #fedora:fedoraproject.org. I think this might also be the reason why some members in the dendrite matrix room have been experiencing missing messages in certain rooms. The impacted user didn't exist in the ban list when I looked.

timaeos avatar Sep 07 '22 15:09 timaeos

as join rule \"invite\" forbids it suggests that a join rule to make the room public was also rejected, do you have any more logs about that?

(Likely containing type=m.room.join_rules in the log line)

neilalexander avatar Sep 08 '22 08:09 neilalexander

I didn't see anything else in the logs but went through the database and it does appear that there is a rejected m.room.join_rules line that was rejected:

 event_nid | room_nid | event_type_nid | event_state_key_nid | sent_to_output | state_snapshot_nid | depth |                   event_
id                   |                          reference_sha256                          |   auth_event_nids   | is_rejected 
-----------+----------+----------------+---------------------+----------------+--------------------+-------+-------------------------
---------------------+--------------------------------------------------------------------+---------------------+-------------
     19430 |        8 |              3 |                   1 | f              |                  0 |     6 | $COF5QW4TA65myp5aLiDDFbX
usssndnlRVDkOxOiHU64 | \x08e179416e1303ae66ca9e5a2e20c315b5eeb2cb2776795154390ec4e88753ae | {19428,19424,19427} | t
    {
        "auth_events":
            [
                "$0YLeWXjlkEijsYF0BBYBBJ0J_eh0cZmAqZ0Igmptybs",
                "$Vl07lTWh6HOGOsvUXNMsToGq-o0Wxc4PcXvFVwESJqw",
                "$Ab61FXKkjwSBjTEryAH3koyi9Ybj-3PyV6PDn1EDSVc"
            ],
        "content":{"join_rule":"public"},
        "depth":6,
        "hashes":{"sha256":"NCcGI3K+0qcp20sjQDF+sF1mLeVv3PMrjnxKQ6IETjU"},
        "origin":"mozilla.org",
        "origin_server_ts":1622077380729,
        "prev_events":["$UbA54rFmbm0Y8ExMZNa9VCoccKW5HON0WEaHwHaWL7E"],
        "prev_state":[],
        "room_id":"!zAeWUNBoXONgkVtgqn:mozilla.org",
        "sender":"@nb:mozilla.org",
        "state_key":"",
        "type":"m.room.join_rules",
        "signatures":
            {
                "mozilla.org":
                {
                    "ed25519:0":"zaI9K4hL15sP9hDMCbOWX/DVVEdtHPaaPtodjgOuGVB2C3P27dzpl31t47AGrQBVeAxPNh3h08Xa1Ie+aWblCg"
                }
            }
    }

Are rejection reasons saved in any of the databases since it seems like it might have happened long ago? Or perhaps I can evacuate the room and then rejoin to see if it rejects the event again?

timaeos avatar Sep 08 '22 14:09 timaeos

Can you please try commit a50556d and leave and rejoin?

neilalexander avatar Sep 23 '22 12:09 neilalexander

I'm going to go ahead and close this because I no longer see it. It was intermittent so it might come back but will just keep it in the back of my mind.

timaeos avatar Oct 05 '22 00:10 timaeos