Skip to content

Security: Use crypto.randomBytes, not Math.random #994

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

Merged
merged 2 commits into from
Feb 8, 2017

Conversation

sgress454
Copy link

This is a backport of https://github.com/websockets/ws/pull/832/files to v1.x, so that projects that still need to support Node < 4 can get the security patch.

This is a backport of https://github.com/websockets/ws/pull/832/files to v1.1.1, so that projects that still need to support Node < 4 can get the security patch.
lib/Sender.js Outdated
~~(Math.random() * 255),
~~(Math.random() * 255)
]);
return require('crypto').randomBytes(4);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a tiny nit: would you mind moving the require at the top of the file along with the others?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@lpinca lpinca merged commit 1653db1 into websockets:v1.x Feb 8, 2017
@lpinca
Copy link
Member

lpinca commented Feb 8, 2017

Thanks!

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