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

The error responses from /leave do not conform to the spec. #13360

Open
Half-Shot opened this issue Jul 22, 2022 · 3 comments
Open

The error responses from /leave do not conform to the spec. #13360

Half-Shot opened this issue Jul 22, 2022 · 3 comments
Labels
A-Leave Leaving a room A-Spec-Compliance places where synapse does not conform to the spec S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@Half-Shot
Copy link
Collaborator

Description

The spec (https://spec.matrix.org/v1.3/client-server-api/#post_matrixclientv3roomsroomidleave) only allows two possible responses from a call to /leave. A 200 if the room was left, or 429 if the request was rate limited.

However, Synapse will return different responses depending on your, and your homeservers state in the room:

  1. Leaving a room that doesn't exist on the host returns "M_UNKNOWN" (Not a known room)
  2. Leaving a room on the host that I was never in (but the host is still joined to via another user) will result in a M_FORBIDDEN.
  3. Leaving a room that I was previously in will always no-op with a 200.

The spec is unfortunately doesn't define the behaviour for trying to leave a room when you were never part of it, but my feeling is that it should no-op in a similar fashion to reinviting users, or rejoining a room also no-op.

Steps to reproduce

For case 1:

  • Try to /leave a random roomID that you totally made up.
  • Observe the error

For case 2:

  • Create a room your homeserver
  • Try to /leave that room from another user who was never joined to it.
  • Observe the error

For case 3:

  • Create a room.
  • Leave the room.
  • Leave the room (and repeat as much as you like)
  • Observe a 200 response with an empty body.

Homeserver

half-shot.uk

Synapse Version

1.60.0

Installation Method

pip (from PyPI)

Platform

Probably not relevant

Relevant log output

Ditto

Anything else that would be useful to know?

No response

@babolivier
Copy link
Contributor

This behaviour has been part of Synapse for ages at this point, so I think it's worth pondering whether this is a Synapse bug or a spec omission.

@babolivier babolivier added S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels Jul 25, 2022
@MadLittleMods MadLittleMods added the A-Leave Leaving a room label Apr 25, 2023
@marijnvanwezel
Copy link

  1. Leaving a room that I was previously in will always no-op with a 200

This is not always the case. If you are banned and unbanned after having previously left a room, you will get the same 403 as if you were never in the room.

@ColonelPhantom
Copy link

It seems that leaving after being kicked also yields a 403 error (M_FORBIDDEN, $USER not in room $ROOM.).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Leave Leaving a room A-Spec-Compliance places where synapse does not conform to the spec S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

5 participants