Auth rules are unclear about which checks apply to auth events and which to room state #1136
Labels
clarification
An area where the expected behaviour is understood, but the spec could do with being more explicit
Per https://spec.matrix.org/v1.3/server-server-api/#checks-performed-on-receipt-of-a-pdu, we check the auth rules three times for each event, based on different subsets of state:
However, some of the auth rules always apply to the auth events, and some are completely independent of any room state input. In particular, per https://spec.matrix.org/v1.3/rooms/v10/#authorization-rules:
m.room.create
:") is completely independent of the room state.auth_events
that:") and rule 3 ("If event does not have am.room.create
in itsauth_events
, reject.") always look at the auth events, never the room state.m.federate
set to false...") is unclear, but since there should be only one create event in a room which is constant throughout the tests, we can consider it as always looking at the auth events.The rest of the rules are intended to apply based on the room state based on the three different state sets mentioned above - but do not say as much.
This is somewhat confusing for the reader, but also makes a faithful implementation rather inefficient, because if we implement it literally we'll check the first four rules three times for exactly the same input.
I've recently (matrix-org/synapse#13065) split the two sets of checks into two functions in Synapse, and rather wonder if we should do the same in the spec.
The text was updated successfully, but these errors were encountered: