Skip to content

Commit

Permalink
Ignore invalid MXIDs in permissions command (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
reivilibre authored Jun 3, 2024
1 parent 340b81a commit 872b572
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/commands/PermissionsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import { ICommand } from "./ICommand";
import { MatrixClient } from "matrix-bot-sdk";
import { LogService, MatrixClient } from "matrix-bot-sdk";
import { Conference } from "../Conference";
import { ResolvedPersonIdentifier } from "../invites";
import { runRoleCommand } from "./actions/roles";
Expand Down Expand Up @@ -49,6 +49,12 @@ export class PermissionsCommand implements ICommand {

for (const person of people) {
if (!person.mxid) continue;

if (! /^@[^:]+:[^\.]+\..+$/.test(person.mxid)) {
LogService.warn("PermissionsCommand", `ignoring invalid MXID ${person.mxid}`);
continue;
}

if (powerLevels['users'][person.mxid]) continue;
powerLevels['users'][person.mxid] = 50;
}
Expand Down

0 comments on commit 872b572

Please sign in to comment.