From c94524eeaf28a62075be078d99f50b47c88d2948 Mon Sep 17 00:00:00 2001 From: Alim TUNC Date: Wed, 5 Jul 2023 15:16:07 +0200 Subject: [PATCH] Salt meet room name --- app/settings-dev.json | 3 ++- core/modules/meet/server/meet.js | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/settings-dev.json b/app/settings-dev.json index 6760801d..358285c0 100644 --- a/app/settings-dev.json +++ b/app/settings-dev.json @@ -241,7 +241,8 @@ "identifier": "", "iss": "", "keyid": "", - "sub": "" + "sub": "", + "salt": "" }, "peer": { diff --git a/core/modules/meet/server/meet.js b/core/modules/meet/server/meet.js index 72f2b32a..a5e81c53 100644 --- a/core/modules/meet/server/meet.js +++ b/core/modules/meet/server/meet.js @@ -1,9 +1,8 @@ import * as jwt from 'jsonwebtoken' +import crypto from 'crypto' import { canAccessZone } from '../../../lib/misc' -const { randomUUID } = require('crypto') - const computeRoomName = (zone) => { check(zone._id, Match.Id) @@ -11,7 +10,7 @@ const computeRoomName = (zone) => { let { uuid } = zone if (!uuid) { - uuid = randomUUID() + uuid = crypto.randomUUID() Zones.update(zone._id, { $set: { uuid } }) } @@ -104,15 +103,22 @@ Meteor.methods({ log('computeMeetLowLevelRoomName: start', { usersIds }) + const salt = Meteor.settings.meet.salt const meetRoomName = usersIds .sort((a, b) => a.localeCompare(b)) .join('-') .toLowerCase() - updateUserRoomName(meetRoomName) - log('computeMeetLowLevelRoomName: end', { meetRoomName }) + const hmac = crypto.createHmac('sha1', salt) + hmac.setEncoding('base64') + hmac.write(meetRoomName) + hmac.end() + hashedMeetRoomName = hmac.read().toLowerCase() + + updateUserRoomName(hashedMeetRoomName) + log('computeMeetLowLevelRoomName: end', { meetRoomName: hashedMeetRoomName }) - return meetRoomName + return hashedMeetRoomName }, })