Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
Salt meet room name
Browse files Browse the repository at this point in the history
  • Loading branch information
alimtunc committed Jul 5, 2023
1 parent 20d1fc4 commit 27b14c3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/settings-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@
"identifier": "",
"iss": "",
"keyid": "",
"sub": ""
"sub": "",
"salt": ""
},

"peer": {
Expand Down
18 changes: 12 additions & 6 deletions core/modules/meet/server/meet.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
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)

log('computeRoomName: start', { zoneId: zone._id })

let { uuid } = zone
if (!uuid) {
uuid = randomUUID()
uuid = crypto.randomUUID()
Zones.update(zone._id, { $set: { uuid } })
}

Expand Down Expand Up @@ -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
},
})

Expand Down

0 comments on commit 27b14c3

Please sign in to comment.