Compare commits

...

4 commits

Author SHA1 Message Date
Tulir Asokan 325891fead
Apply suggestion from @richvdh
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2026-02-24 15:21:54 +02:00
Tulir Asokan 8bb5138185 Make example responses match recommendations 2026-02-24 15:21:16 +02:00
Tulir Asokan aa3abad39a Adjust wording so the validation reads nicer 2026-02-24 15:19:46 +02:00
Tulir Asokan 521bf40761 Don't mandate specific error code 2026-02-24 15:17:07 +02:00
8 changed files with 23 additions and 29 deletions

View file

@ -1 +1 @@
Specified input validation for PDUs passed to and returned from federation membership endpoints.
Specify validation for PDUs passed to and returned from federation membership endpoints.

View file

@ -38,8 +38,8 @@ paths:
transaction](/server-server-api/#transactions).
Servers MUST apply certain validation to ensure they don't accidentally sign non-invite
events from a malicious server. The `M_MISSING_PARAM` error code is used to indicate one
or more of the following:
events from a malicious server. A specific error code is not mandated, but servers SHOULD
return `M_INVALID_PARAM` if:
* The invite event fails a [signature check](/server-server-api/#validating-hashes-and-signatures-on-received-events).
* The event type is not `m.room.member`.
@ -47,8 +47,9 @@ paths:
* The event sender is not a user ID on the origin server.
* The `state_key` is not a user ID on the receiving server.
The `M_MISSING_PARAM` error code is also used to indicate one or more of the following
problems in the `invite_room_state` field:
The `invite_room_state` has additional validation, which servers MAY apply to room versions
1 through 11 and SHOULD apply to all other room versions. As with the above errors, servers
SHOULD return `M_INVALID_PARAM` if:
* The `m.room.create` event is missing from `invite_room_state`.
* One or more entries in `invite_room_state` are not formatted according
@ -57,9 +58,6 @@ paths:
* One or more events does not reside in the same room as the invite.
Note: Some room versions may require calculating the room ID for an
event rather than relying on the presence of `room_id`.
Servers MAY apply the `invite_room_state` validation to room versions 1 through 11,
and SHOULD apply the validation to all other room versions.
operationId: sendInviteV1
security:
- signedRequest: []
@ -107,8 +105,7 @@ paths:
MUST additionally be formatted according to the room version specification.
Servers might need to apply validation to the `invite_room_state` depending
on room version. See the `400 M_MISSING_PARAM` error definition for more
information.
on room version. See endpoint description for more information.
Note that events have a different format depending on the room
version - check the [room version specification](/rooms) for
@ -210,7 +207,7 @@ paths:
examples:
response:
value: {
"errcode": "M_MISSING_PARAM",
"errcode": "M_INVALID_PARAM",
"error": "Create event not among invite state entries."
}
servers:

View file

@ -42,8 +42,8 @@ paths:
transaction](/server-server-api/#transactions).
Servers MUST apply certain validation to ensure they don't accidentally sign non-invite
events from a malicious server. The `M_MISSING_PARAM` error code is used to indicate one
or more of the following:
events from a malicious server. A specific error code is not mandated, but servers SHOULD
return `M_INVALID_PARAM` if:
* The invite event fails a [signature check](/server-server-api/#validating-hashes-and-signatures-on-received-events).
* The event type is not `m.room.member`.
@ -51,8 +51,9 @@ paths:
* The event sender is not a user ID on the origin server.
* The `state_key` is not a user ID on the receiving server.
The `M_MISSING_PARAM` error code is also used to indicate one or more of the following
problems in the `invite_room_state` field:
The `invite_room_state` has additional validation, which servers MAY apply to room versions
1 through 11 and SHOULD apply to all other room versions. As with the above errors, servers
SHOULD return `M_INVALID_PARAM` if:
* The `m.room.create` event is missing from `invite_room_state`.
* One or more entries in `invite_room_state` are not formatted according
@ -61,9 +62,6 @@ paths:
* One or more events does not reside in the same room as the invite.
Note: Some room versions may require calculating the room ID for an
event rather than relying on the presence of `room_id`.
Servers MAY apply the `invite_room_state` validation to room versions 1 through 11,
and SHOULD apply the validation to all other room versions.
operationId: sendInviteV2
security:
- signedRequest: []
@ -108,8 +106,7 @@ paths:
MUST additionally be formatted according to the room version specification.
Servers might need to apply validation to the `invite_room_state` depending
on room version. See the `400 M_MISSING_PARAM` error definition for more
information.
on room version. See the endpoint description for more information.
Note that events have a different format depending on the room
version - check the [room version specification](/rooms) for
@ -178,8 +175,8 @@ paths:
The error should be passed through to clients so that they
may give better feedback to users.
If `M_MISSING_PARAM` is returned and the request is associated with a
Client-Server API request, the Client-Server API request SHOULD fail
If `M_MISSING_PARAM` or `M_INVALID_PARAM` is returned and the request is associated
with a Client-Server API request, the Client-Server API request SHOULD fail
with a 5xx error rather than being passed through.
content:
application/json:

View file

@ -251,7 +251,7 @@ paths:
fields for a PDU.**
The receiving server MUST apply certain validation before accepting the event.
The `M_INVALID_PARAM` error code is used to indicate one or more of the following:
A specific error code is not mandated, but servers SHOULD return `M_INVALID_PARAM` if:
* The join event fails a [signature check](/server-server-api/#validating-hashes-and-signatures-on-received-events).
* The event type is not `m.room.member`.

View file

@ -40,7 +40,7 @@ paths:
fields for a PDU.**
The receiving server MUST apply certain validation before accepting the event.
The `M_INVALID_PARAM` error code is used to indicate one or more of the following:
A specific error code is not mandated, but servers SHOULD return `M_INVALID_PARAM` if:
* The join event fails a [signature check](/server-server-api/#validating-hashes-and-signatures-on-received-events).
* The event type is not `m.room.member`.
@ -256,8 +256,8 @@ paths:
The error should be passed through to clients so that they
may give better feedback to users.
If `M_MISSING_PARAM` is returned and the request is associated with a
Client-Server API request, the Client-Server API request SHOULD fail
If `M_MISSING_PARAM` or `M_INVALID_PARAM` is returned and the request is associated
with a Client-Server API request, the Client-Server API request SHOULD fail
with a 5xx error rather than being passed through.
New in `v1.2`, the following error conditions might happen:

View file

@ -217,7 +217,7 @@ paths:
fields for a PDU.**
The receiving server MUST apply certain validation before accepting the event.
The `M_INVALID_PARAM` error code is used to indicate one or more of the following:
A specific error code is not mandated, but servers SHOULD return `M_INVALID_PARAM` if:
* The knock event fails a [signature check](/server-server-api/#validating-hashes-and-signatures-on-received-events).
* The event type is not `m.room.member`.

View file

@ -166,7 +166,7 @@ paths:
fields for a PDU.**
The receiving server MUST apply certain validation before accepting the event.
The `M_INVALID_PARAM` error code is used to indicate one or more of the following:
A specific error code is not mandated, but servers SHOULD return `M_INVALID_PARAM` if:
* The leave event fails a [signature check](/server-server-api/#validating-hashes-and-signatures-on-received-events).
* The event type is not `m.room.member`.

View file

@ -40,7 +40,7 @@ paths:
fields for a PDU.**
The receiving server MUST apply certain validation before accepting the event.
The `M_INVALID_PARAM` error code is used to indicate one or more of the following:
A specific error code is not mandated, but servers SHOULD return `M_INVALID_PARAM` if:
* The leave event fails a [signature check](/server-server-api/#validating-hashes-and-signatures-on-received-events).
* The event type is not `m.room.member`.