Skip to content

Commit

Permalink
security: use constant-time comparison to prevent timing attack
Browse files Browse the repository at this point in the history
  • Loading branch information
boybundit committed Jan 29, 2018
1 parent 443e55b commit 356b98c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/linebot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LineBot extends EventEmitter {
return false;
}
let res = 0;
for (let i = 0; i < Math.min(hash.length, signature.length); i++) {
for (let i = 0; i < hash.length; i++) {
res |= (hash.charCodeAt(i) ^ signature.charCodeAt(i));
}
return res === 0;
Expand Down

0 comments on commit 356b98c

Please sign in to comment.