Skip to content

Commit 872b572

Browse files
authored
Ignore invalid MXIDs in permissions command (#229)
1 parent 340b81a commit 872b572

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/commands/PermissionsCommand.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import { ICommand } from "./ICommand";
18-
import { MatrixClient } from "matrix-bot-sdk";
18+
import { LogService, MatrixClient } from "matrix-bot-sdk";
1919
import { Conference } from "../Conference";
2020
import { ResolvedPersonIdentifier } from "../invites";
2121
import { runRoleCommand } from "./actions/roles";
@@ -49,6 +49,12 @@ export class PermissionsCommand implements ICommand {
4949

5050
for (const person of people) {
5151
if (!person.mxid) continue;
52+
53+
if (! /^@[^:]+:[^\.]+\..+$/.test(person.mxid)) {
54+
LogService.warn("PermissionsCommand", `ignoring invalid MXID ${person.mxid}`);
55+
continue;
56+
}
57+
5258
if (powerLevels['users'][person.mxid]) continue;
5359
powerLevels['users'][person.mxid] = 50;
5460
}

0 commit comments

Comments
 (0)