Web Security · Senior · Question 41 of 75

Which source of randomness should be used for session IDs and reset tokens in a browser or Node.js?

Explanation

Math.random() isn't designed to be unpredictable. Security tokens need a cryptographically secure generator.

Further reading

Problem with a question

Web Security · Senior · question 41

Test yourself

Take the Web Security · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz