fix: only process admin commands if server user is in the room
Should prevent some edge cases with a misconfigured admin room Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
0688a96c37
commit
26d103d314
1 changed files with 7 additions and 1 deletions
|
@ -489,7 +489,13 @@ impl Service {
|
||||||
// the administrator can execute commands as conduit
|
// the administrator can execute commands as conduit
|
||||||
let from_conduit = pdu.sender == server_user && services().globals.emergency_password().is_none();
|
let from_conduit = pdu.sender == server_user && services().globals.emergency_password().is_none();
|
||||||
if let Some(admin_room) = service::admin::Service::get_admin_room().await? {
|
if let Some(admin_room) = service::admin::Service::get_admin_room().await? {
|
||||||
if to_conduit && !from_conduit && admin_room == pdu.room_id {
|
if to_conduit
|
||||||
|
&& !from_conduit && admin_room == pdu.room_id
|
||||||
|
&& services()
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.is_joined(&UserId::parse(server_user).unwrap(), &admin_room)?
|
||||||
|
{
|
||||||
services()
|
services()
|
||||||
.admin
|
.admin
|
||||||
.process_message(body, pdu.event_id.clone())
|
.process_message(body, pdu.event_id.clone())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue