element-hq / element-hq/synapse

Room and group names should be limited to a sensible length

Open
#8,151 0 comments 0 reactions 0 assignees View on GitHub
O-Uncommon S-Minor T-Defect Z-Help-Wanted
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#8151](https://github.com/matrix-org/synapse/issues/8151).

---

### Description

You can set room names and topics to absurdly long strings, which don't fit in a matrix state event. As a result, when you create a room in Element doing so, you get a room with no name/topic as the state event failed to send.

Synapse should fail the `/createRoom` call instead immediately instead of creating a room with no name/topic.

There's a similar issue with groups, though while the group is created successfully, being able to create groups with unlimited-length names is not ideal.

We already [limit the size of usernames](https://github.com/matrix-org/synapse/blob/8c7d0f163d8247297dbcfd5f257b652ebe417fff/synapse/rest/admin/users.py#L376) to 512 characters, returning a 400 `M_UNKNOWN`. We can do this again for now, but it'd be nice to get an appropriate error code to return so that clients can show a helpful reason as to why creating the room failed. Related spec issue: https://github.com/matrix-org/matrix-doc/issues/1646

### Steps to reproduce

- Create a room with a reaaaaaaally long name (>65K chars)
- The `/createRoom` call fails with a 500
- Notice that a room is created anyways

### Version information

v1.19.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.