Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Attempting to call /messages on a room that doesn't exist results in a 500 #12678

Closed
@bradtgmurray

Description

@bradtgmurray

Description

Requesting messages for a nonsense room id should probably return a 404 or a 403, but instead it just blows up in Sentry with a 500 here: https://github.com/matrix-org/synapse/blob/develop/synapse/handlers/pagination.py#L451

Interestingly the spec only says 200 or 403 (You're not a member of this room) are valid responses.
https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3roomsroomidmessages

Steps to reproduce

Throw this in your javascript console for your element web login

await fetch("https://matrix-client.matrix.org/_matrix/client/r0/rooms/!doesnotexist%3Amatrix.org/messages?limit=20&dir=b", {
  "headers": {
    "authorization": "Bearer <your access token here>",
  },
  "method": "GET",
}).then(r => r.json());

Version information

Beeper's fork of 1.57.1 (haven't gotten to 1.58 yet) but reproduced as well on matrix.org (above)

Metadata

Metadata

Assignees

Labels

A-Messages-Endpoint/messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill)S-MinorBlocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.X-RegressionSomething broke which worked on a previous release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions