-
-
Notifications
You must be signed in to change notification settings - Fork 118
Open
Labels
clarificationAn area where the expected behaviour is understood, but the spec could do with being more explicitAn area where the expected behaviour is understood, but the spec could do with being more explicit
Description
Link to problem area: https://spec.matrix.org/v1.2/rooms/v9/#authorization-rules
Issue
The auth rules begin:
- If type is m.room.create:
- If it has any previous events, reject.
- If the domain of the room_id does not match the domain of the sender, reject.
- If content.room_version is present and is not a recognised version, reject.
- If content has no creator field, reject.
- Otherwise, allow.
I understand this to mean that m.room.create
events:
- MUST NOT have any
prev_events
. - (implicitly) MUST have a
sender
, aroom_id
and acontent
field, each with appropriate types.- this is vaguely guaranteed by the S-S API's checks on PDUs, which asserts that each incoming event "is a valid event". (See also Better specify how to validate events #365.)
- This presumably means that it compiles to the PDU format of the given room version, and additionally complies to the room-agnostic specification of
m.room.create
's content, defined in the C-S API spec.
- (implicitly): MUST have a
room_id
andsender
which are matrix IDs.- Again, arguably covered by "the event is valid".
- MUST have matching domains for the
room_id
andsender
. - MUST have a
content.room_version
field which represents a recognised room version. - MUST have a
content.creator
field.
I can see the following holes and problems n this definition.
- There is no requirement that
content.creator
is an MXID, nor that its domain matches that of theroom_id
orsender
. Come to think of it, why is thecontent.creator
required at all, when the event already contains asender
? Should servers consider the event invalid if the creator and sender disagree? - This doesn't mention
auth_events
at all. Should servers ignore any auth events onm.room.create
, or reject such events?- I don't think it makes sense to include any auth_events here at all. Maybe you could make an argument for room upgrades, but there's a "Previous Room" field for that in the event's content.
- Suppose
@alice:server
creates a room!room:server
. What is there to stop@bob:server
from trying to create a new room with the same ID?- If so, how should homeservers processing these two events decide who wins? (
origin_server_ts
, tiebreaking lexicographically on the creator's MXID?) - The client-server API is supposed to forbid this with
M_ROOM_IN_USE
, but a buggy or malicious homeserver could send whatever PDUs it likes.
- If so, how should homeservers processing these two events decide who wins? (
Additionally:
- A cross-reference to the definition of
m.room.create
would be useful here (though note my confusion and complaints in Confusing cycle: S-S API -> room version auth rules -> S-S api auth events selection #1046).
Metadata
Metadata
Assignees
Labels
clarificationAn area where the expected behaviour is understood, but the spec could do with being more explicitAn area where the expected behaviour is understood, but the spec could do with being more explicit