Skip to content
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

Use Symfony’s SecureRandom instead of home-grown crypto code #86

Open
lstrojny opened this issue Nov 20, 2015 · 4 comments · May be fixed by #94
Open

Use Symfony’s SecureRandom instead of home-grown crypto code #86

lstrojny opened this issue Nov 20, 2015 · 4 comments · May be fixed by #94

Comments

@lstrojny
Copy link

What about using Symfony’s SecureRandom or random_bytes() to generate tokens?

@Spomky
Copy link

Spomky commented Nov 22, 2015

random_bytes() is only for PHP 7 right? SecureRandom also is a good choice.
IMHO, a better way could be to create an interface (let say RandomStringGenerator) and modify the libary to rely on this interface.Then let developpers decide the generator they want to use.
If no generator is set, the default one is used.

@mvrhov
Copy link

mvrhov commented Nov 23, 2015

Then I would recommend on using paragonie/random_compat

@stof
Copy link
Member

stof commented Nov 23, 2015

IMO, the right way is to use random_bytes and to use paragonie/random_compat for PHP 5 (this is what Symfony does now. SecureRandom is deprecated).

There is no point allowing developers to switch to a less secure generator IMO.

@lstrojny
Copy link
Author

Makes sense, the only downside is that you can’t mock out random numbers anymore easily.

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 a pull request may close this issue.

4 participants