Skip to content

mcp: replace custom randText implementation with crypto/rand.Text #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yasomaru
Copy link
Contributor

  • Remove custom base32alphabet constant and manual implementation
  • Use Go 1.24's crypto/rand.Text() function for secure random text generation
  • Simplify code by removing 26 lines of custom implementation
  • Maintain same functionality with standard library implementation

This change resolves TODO comments about using crypto/rand.Text once Go 1.24 is assured. The standard library implementation provides the same security guarantees with better maintainability and consistency.

Fixes: #TODO (use crypto/rand.Text)

- Remove custom base32alphabet constant and manual implementation
- Use Go 1.24's crypto/rand.Text() function for secure random text generation
- Simplify code by removing 26 lines of custom implementation
- Maintain same functionality with standard library implementation

This change resolves TODO comments about using crypto/rand.Text once Go 1.24
is assured. The standard library implementation provides the same security
guarantees with better maintainability and consistency.

Fixes: #TODO (use crypto/rand.Text)
@jba
Copy link
Contributor

jba commented Aug 18, 2025

Thanks. I don't know if we're ready to give up on 1.23 just yet. 1.25 just came out. But we can keep this around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants