Skip to content

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

Merged
lpinca merged 2 commits intowebsockets:v1.xfrom
sgress454:backport-crypto-patch-to-1.0
Feb 8, 2017
Merged

Security: Use crypto.randomBytes, not Math.random#994
lpinca merged 2 commits intowebsockets:v1.xfrom
sgress454:backport-crypto-patch-to-1.0

Conversation

@sgress454
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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