Skip to content

fix: secure classroom invite codes - #901

Closed
saurabhhhcodes wants to merge 1 commit into
knoxiboy:mainfrom
saurabhhhcodes:fix/rooms-invite-code-789
Closed

fix: secure classroom invite codes#901
saurabhhhcodes wants to merge 1 commit into
knoxiboy:mainfrom
saurabhhhcodes:fix/rooms-invite-code-789

Conversation

@saurabhhhcodes

@saurabhhhcodes saurabhhhcodes commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Closes #789

Replaces the classroom invite code generator in src/app/api/rooms/route.ts with crypto.randomBytes(...) so room codes are no longer derived from Math.random().

Validation:

  • git diff --check
  • npx tsc --noEmit --pretty false

Summary by CodeRabbit

  • Bug Fixes
    • Improved classroom invite code generation with stronger randomness.
    • Reduced the likelihood of duplicate or predictable invite codes.

@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Karan Mani Tripathi 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codeant-ai

codeant-ai Bot commented Jul 11, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@codeant-ai

codeant-ai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@github-actions github-actions Bot added gssoc'26 GSSoC program issue level:intermediate Intermediate level task type:bug Bug fix labels Jul 11, 2026
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 825fd000-4092-42c9-97f6-07c132e2e0da

📥 Commits

Reviewing files that changed from the base of the PR and between 8e7bd25 and 3bb7d30.

📒 Files selected for processing (1)
  • src/app/api/rooms/route.ts

Walkthrough

The room API now imports randomBytes and generates classroom invite codes as uppercase hexadecimal strings from four cryptographically random bytes. Other GET and POST control flow remains unchanged.

Changes

Room invite-code generation

Layer / File(s) Summary
Use cryptographic invite-code generation
src/app/api/rooms/route.ts
The route imports randomBytes and replaces Math.random() invite-code generation with an uppercase hexadecimal code derived from four random bytes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • knoxiboy/DoubtDesk#785: Updates the same room route and invite-code generation logic to use crypto.randomBytes.

Suggested labels: type:security

Suggested reviewers: knoxiboy

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

❌ PR Rejected — Issue Assignment Check Failed

Hi @saurabhhhcodes! This PR has been closed because you are not assigned to the issue(s) it references:

What to do:

  1. Comment /assign on the issue to request assignment from a maintainer.
  2. Wait until you are officially assigned.
  3. Then re-open or re-submit your PR.

PRs that fix issues not assigned to the author cannot be accepted — this ensures fair contribution tracking.

@github-actions github-actions Bot added the invalid This doesn't seem right label Jul 11, 2026
@github-actions github-actions Bot closed this Jul 11, 2026
@knoxiboy knoxiboy removed gssoc'26 GSSoC program issue level:intermediate Intermediate level task type:bug Bug fix size/xs labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security]: Classroom Invite Code Generated with Math.random()

2 participants