element-hq / element-hq/synapse

Apply strict MSC4311 stripped state validation after 2027-06-01

Open
#19,943 3 comments 0 reactions 0 assignees View on GitHub
A-Invite A-Knock A-Spec-Compliance
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

[MSC4311](https://github.com/matrix-org/matrix-spec-proposals/pull/4311) says that for "version 12+ rooms, servers **SHOULD** rather than **MAY** respond to such requests with 400 M_MISSING_PARAM":

> If any of the events are not a PDU, not for the room ID specified, or fail
> signature checks, or the `m.room.create` event is missing, the receiving
> server MAY respond to invites with a `400 M_MISSING_PARAM` standard Matrix
> error (new to the endpoint). For invites to room version 12+ rooms, servers
> SHOULD rather than MAY respond to such requests with `400 M_MISSING_PARAM`.
>
> *-- [MSC4311](https://github.com/matrix-org/matrix-spec-proposals/pull/4311)*

Currently, we only log in room versions 12+ where this **SHOULD** be the case already.

After 2027-06-01 (to allow some time for the ecosystem to adapt and support MSC4311), instead of logging, we should reject with 400 `M_MISSING_PARAM`. Given we have the lee-way to enforce this in all room versions (granted by the **MAY** langauge in the spec), we might as well. This is marked as a leftover `FIXME` task in https://github.com/element-hq/synapse/pull/19723

### Definition of done

- [ ] Strictly reject events which don't conform to MSC4311 in room versions 12+ (**SHOULD**)
- [ ] Strictly reject events which don't conform to MSC4311 in all room versions (**MAY**)
- We could push the date out further for room versions <12 as some homeservers will just never update
- [ ] Unskip the `TestMSC4311RejectInvalidStrippedStateFederation` Complement tests

### Dev notes

Synapse PR: https://github.com/element-hq/synapse/pull/19723

Complement tests: https://github.com/matrix-org/complement/pull/796

Contributor guide

Open the contributing guide

Research direction

Start by reviewing Synapse PR #19723 and the skipped Complement test TestMSC4311RejectInvalidStrippedStateFederation, then trace the current logging path for invalid stripped state. The work is done when invalid events receive 400 M_MISSING_PARAM, the room-version requirements are covered, and the Complement tests are unskipped, with enforcement beginning after 2027-06-01.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.