This repository was archived by the owner on Apr 26, 2024. It is now read-only.
E2EE permission check too late when creating a room #15688
Labels
O-Uncommon
Most users are unlikely to come across this or unexpected workflow
S-Minor
Blocks non-critical functionality, workarounds exist.
T-Defect
Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Description
For context: I have an in-house Synapse server on which I am disabling E2EE with default_power_level_content_override. Our configuration sets the power level required for sending the
m.room.encryption
event to 999.This mostly works, except for the following.
If a user attempts to create a room with E2EE enabled, the normal server sequence includes these steps:
m.room.create
eventm.room.member
eventm.room.encryption
eventm.room.power_levels
eventWith the power levels overridden as described above, the API request is correctly rejected with a 403 and the server logs this message:
Unfortunately, the exception for the 403 response is raised after the
m.room.create
event and before them.room.power_levels
event. Which means that the room is created, but the power level overrides are not applied. So the room will appear as "Empty Room" in the Element client and the user can complete the initialisation by manually setting the room name and enabling encryption.I have made a proof of concept patch that checks the creator's intent (with respect to E2EE) earlier and raises the 403 error sooner so the user doesn't get ownership of a partially configured room. With this patch, the room_id does still get allocated in the rooms table, but I'm not sure it's worth the trouble to avoid that.
Any guidance on progressing this to a PR gratefully accepted.
Steps to reproduce
homeserver.yaml
to disallow users from enabling E2EE:default_power_level_content_override
values were not applied and in room settings the value form.room.encryption
is 100 rather than 999Homeserver
A private in-house server
Synapse Version
1.84.0rc1
Installation Method
pip (from PyPI)
Database
PostgreSQL
Workers
Single process
Platform
Server for these tests was a development environment running on a laptop running Ubuntu 20.04 with the homeserver process running directly in the host OS (not in a container)
Configuration
Yes, see
default_power_level_content_override
setting above.Relevant log output
Anything else that would be useful to know?
No response
The text was updated successfully, but these errors were encountered: