Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

importing a node module create an error

Tags:

node.js

I imported node module 'request' in app.js but as soon as my script read,

var request = require('request'); 

it creates an error like below. Anyone has an idea?

Error Message:

[SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random()

like image 813
안광섭 Avatar asked Mar 21 '16 06:03

안광섭


1 Answers

request depends on the library node-uuid. 'node-uuid' is used for generating random UUID's, also called GUID's.

To get truly random UUID's, node-uuid requires a cryptographically secure random source. Normally it will use crypto.randomBytes (in node) or crypto.getRandomValues (in the browser), but if that does not exist it will fall back to Math.Random. However, Math.random cannot generate cryptographically secure random numbers (read here for more info).

Request uses UUID's for its OAuth nonces and multipart file uploads. If you use OAuth, not having secure random nonces may be a security concern.

The crypto module should be present in all node installations (to my knowledge), so it's likely that you are running this code in a web browser environment. You may be running in a web browser that doesn't support the crypto module quite yet, and therefore Math.random is really your only option. You can check the can i use page to see if your browser supports getRandomValues.

like image 148
Chris Foster Avatar answered Sep 19 '22 21:09

Chris Foster