Trim usernames

Previously it was possible to "impersonate" (to those not looking closely) other users by putting whitespace before or after the name of choice. This commit eliminates that.
This commit is contained in:
dakrk
2023-05-06 15:21:18 +01:00
parent 41bf76ab0d
commit 3f753c60da

View File

@@ -527,6 +527,7 @@ export default class WSServer {
if (!newName) { if (!newName) {
client.assignGuestName(this.getUsernameList()); client.assignGuestName(this.getUsernameList());
} else { } else {
newName = newName.trim();
if (hadName && newName === oldname) { if (hadName && newName === oldname) {
//@ts-ignore //@ts-ignore
client.sendMsg(guacutils.encode("rename", "0", "0", client.username, client.rank)); client.sendMsg(guacutils.encode("rename", "0", "0", client.username, client.rank));