From a68c6f0a7d82710410fb2764f8b8d2fc9b381093 Mon Sep 17 00:00:00 2001 From: Doug Date: Wed, 9 Aug 2023 10:51:10 +0100 Subject: [PATCH] Only use the sender when rendering the room creation event. On Room v11 it is possible that the sender could put in a fake creator. Don't allow this to happen. --- .../Utils/EventFormatter/MXKEventFormatter.m | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m index 7ae98184a3..d6a3b5cfd3 100644 --- a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m +++ b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m @@ -830,15 +830,10 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent*)event } case MXEventTypeRoomCreate: { - NSString *creatorId; - MXJSONModelSetString(creatorId, event.content[@"creator"]); - - if (!creatorId) - { - // Room version 11 removes `creator` in favour of `sender`. - // https://github.com/matrix-org/matrix-spec-proposals/pull/2175 - creatorId = event.sender; - } + // Room version 11 removes `creator` in favour of `sender`. + // https://github.com/matrix-org/matrix-spec-proposals/pull/2175 + // Just use the sender as it is possible to create a v11 room and spoof the `creator`. + NSString *creatorId = event.sender; if ([creatorId isEqualToString:mxSession.myUserId]) {