Node added a function to its crypto library, timingSafeEqual which can be used to mitigate the risk of a timing-based attack on signatures. (See https://codahale.com/a-lesson-in-timing-attacks for a good explanation of timing attacks).
In short, using a normal string comparison function leaks information about how different the provided signature is from the correct one because a string with a longer matching prefix will take longer to return. This change uses the existing string comparison when timingSafeEqual is not available.
Node added a function to its crypto library,
timingSafeEqual
which can be used to mitigate the risk of a timing-based attack on signatures. (See https://codahale.com/a-lesson-in-timing-attacks for a good explanation of timing attacks).In short, using a normal string comparison function leaks information about how different the provided signature is from the correct one because a string with a longer matching prefix will take longer to return. This change uses the existing string comparison when
timingSafeEqual
is not available.