fix: use crypto/rand for OTP generation by lakhansamani · Pull Request #489 · authorizerdev/authorizer

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@lakhansamani

Copy link Copy Markdown

Contributor

Summary

  • Replaced insecure math/rand with crypto/rand for OTP generation
  • Removed per-call re-seeding that caused identical OTPs for concurrent calls

Test plan

  • Verify OTPs are generated correctly with 6 characters
  • Verify concurrent OTP generation produces unique values

Fixes #478

Replaced insecure math/rand with crypto/rand for cryptographically
secure OTP generation. The previous implementation was predictable
and could produce identical OTPs for concurrent calls.

Fixes #478

@lakhansamani lakhansamani merged commit 695952e into main

Mar 1, 2026

@lakhansamani lakhansamani deleted the fix/secure-otp-generation branch

March 1, 2026 06:48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

OTP generated with insecure math/rand

1 participant

@lakhansamani