matrix-org / matrix-org/gomatrixserverlib

๐ŸŸ breaks join rules

Open
#450 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
67
Forks
60
PR merge metrics
No merged PRs in 30d

Description

"allow": "๐ŸŸ" breaks the join rules in dendrite, and presumably this is caused by GMSL.

Take for example

{"allow": "๐ŸŸ", "join_rule": "knock"}

this m.room.join_rules event content.

From what I can gather, rather than ignoring the invalid allow field, GMSL is failing to unmarshal the event at all, causing the JoinRuleEventContent.JoinRule to be "", or an empty string, which is not allowed by spec, causing valid joins to fail.

The solution to this is to ignore the invalid allow value (unless the join_rule is restricted or knock_restricted, otherwise the event must always fail joins without an invite per the spec), however I dug into the code briefly myself and got a bit lost. It's entirely possible that it's not an unmarshal error that's being discarded but in fact just the join rule itself being entirely discarded and consequently not set, leading to the default for string being used.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up โ€” it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how GMSL unmarshals m.room.join_rules event content into JoinRuleEventContent.JoinRule, including handling of the invalid allow value. Confirm the behavior for the shown knock event and compare it with restricted and knock_restricted rules; done means invalid allow data no longer prevents valid join-rule handling and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.