Skip to content

Commit

Permalink
Only use the sender when rendering the room creation event.
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 committed Aug 9, 2023
1 parent d3e64c1 commit a68c6f0
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 a68c6f0

Please sign in to comment.