Security: Room IDs are generated with non-cryptographic randomness#1235
Conversation
…c rand Room identifiers are created with `Math.random()`, which is predictable and not suitable for security-sensitive identifiers. Predictable room IDs increase the risk of room enumeration and unauthorized access attempts, especially when IDs are part of join URLs. Affected files: generateRoomId.ts Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
|
|
@CodeRabbit full review |
✅ Actions performedFull review triggered. |
|
I guess this would be more suitable to backport the generation of this id on the server side. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |



Problem
Room identifiers are created with
Math.random(), which is predictable and not suitable for security-sensitive identifiers. Predictable room IDs increase the risk of room enumeration and unauthorized access attempts, especially when IDs are part of join URLs.Severity:
mediumFile:
src/frontend/src/features/rooms/utils/generateRoomId.tsSolution
Use a cryptographically secure generator (
crypto.getRandomValues/crypto.randomUUID) and increase effective entropy of room identifiers. Also enforce server-side authorization regardless of ID secrecy.Changes
src/frontend/src/features/rooms/utils/generateRoomId.ts(modified)Testing