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

Room creations denied by user_may_create_room should cause a M_FORBIDDEN error to be returned, not M_UNKNOWN #11245

Closed
jaller94 opened this issue Nov 4, 2021 · 7 comments
Labels
good first issue Good for newcomers S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.

Comments

@jaller94
Copy link
Contributor

jaller94 commented Nov 4, 2021

Description:
0. Have a Synapse module that prevents you from creating a room.

  1. Try to create a room.

Actual

HTTP 403 on POST /_matrix/client/r0/createRoom

{
  "errcode":"M_UNKNOWN",
  "error":"You are not permitted to create rooms"
}

The UI is unsure what to tell the user, making it seem like this could succeed on retry:

Expected

The Matrix errcode M_FORBIDDEN would be more specific and fits the error message.

@babolivier
Copy link
Contributor

Slightly related (since it's around error handling): #11031

@babolivier
Copy link
Contributor

@jaller94

Have a Synapse module that prevents you from creating a room.

There are a few module callbacks that prevent you from creating a room, could you be more specific here please?

@reivilibre
Copy link
Contributor

iirc I saw this behaviour when working on https://github.com/matrix-org/synapse-user-restrictions/ with the user_may_create_room spam checker callback.

@reivilibre reivilibre added S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. good first issue Good for newcomers labels Nov 4, 2021
@babolivier
Copy link
Contributor

babolivier commented Nov 4, 2021

As per DM, the module indeed uses user_may_create_room (and denies room creation by returning False upon getting called on that callback).

@babolivier babolivier changed the title /createRoom: Return M_FORBIDDEN for insufficient permissions Room creations denied by user_may_create_room should cause a M_FORBIDDEN error to be returned, not M_UNKNOWN Nov 4, 2021
@lukasdenk
Copy link
Contributor

I'll try to fix it 😃

@lukasdenk
Copy link
Contributor

@jaller94 I fixed the issue in the above PR. Could you please close the issue?

@DMRobertson
Copy link
Contributor

@lukasdenk For what it's worth, prefer linking the PR and the issue together as described here---that'll automatically close the issue if the PR is merged.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.
Projects
None yet
Development

No branches or pull requests

5 participants