Skip to content

Commit

Permalink
Only use the sender when rendering the room creation event. (#7640)
Browse files Browse the repository at this point in the history
On Room v11 it is possible that the sender could put in a fake creator. Don't allow this to happen.
  • Loading branch information
pixlwave authored Aug 9, 2023
1 parent 41b36e0 commit f3b857f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -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])
{
Expand Down

0 comments on commit f3b857f

Please sign in to comment.