Skip to content

Re-clarify the auth rules around invite->knock transitions #1710

@kegsay

Description

@kegsay

This is a mess so strap yourself in.

Background

Knocking was introduced in MSC2403 and got merged in March 2021. It introduced a new membership state "knock" along with a set of membership transitions to and from it. A puzzling question revolved around the transition from "invite" to "knock". Generally, this makes no sense. A user knocks on a room to receive an invite. If the inviting user wishes to disinvite the user, there is an existing transition from "invite" to "leave" to reflect this. Adding extra transitions increases complexity of the already complex membership state transition diagram. Extra complexity increases the risk of implementation errors or protocol errors.

Timeline

MSC2043, at the point it is accepted in March 2021, does not permit a transition from invite to knock in the auth rules: https://github.com/matrix-org/matrix-spec-proposals/blob/8f304ca9e567ca5b5630992025453b9a21a81b60/proposals/2403-knock.md#auth-rules.

Likewise, the April 2021 spec PR which adopted MSC2043 into the spec, forbade invite->knock transitions in both the auth rules and the state transition table.

The Synapse implementation also did not allow this transition.

Now, this is what happened next..

Current situation

Now Dendrite is looking to implement this, and I see this transition and think this is silly. I look for the rationale why this was allowed and uncover a series of unfortunate events:

The end result is that we have a specification which was clarified incorrectly, meanwhile the Synapse implementation has always disallowed the transition since the MSC was merged.

Next steps

The immediate issue is to urgently clarify the clarification to disallow the state transition before more of the ecosystem allows it. Broad consensus is that is "silly" and really not needed, so we should let sanity prevail and not allow the transition.

There are core underlying issues here though which need to be mentioned. A critical part of the specification was changed (event auth rules) without [adequately] checking what the original implementation did, but yet the implementation was used as a rationale for the change in the first place. Clearly this should never have been permitted and the spec process should have caught this. We need more oversight on this. Accidents happen, and we should not be relying on human memory for critical parts of the specification. In this particular case, multiple people incorrectly claimed the transition was allowed in the implementation. I propose any change to event auth rules, or other access-control-like sections of the specification MUST have external validation in code, to prove out any changes. In practice, I would propose this means having Complement tests (or some other server-agnostic test suite) whenever we wish to change the specification due to the implementation having a certain behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clarificationAn area where the expected behaviour is understood, but the spec could do with being more explicit

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions