Skip to content

fix(index): stop type coercion#88

Merged
Fdawgs merged 2 commits intomainfrom
Fdawgs-patch-1
May 6, 2025
Merged

fix(index): stop type coercion#88
Fdawgs merged 2 commits intomainfrom
Fdawgs-patch-1

Conversation

@Fdawgs
Copy link
Member

@Fdawgs Fdawgs commented May 4, 2025

The global isFinite() attempts type coercion whilst Number.isFinite() does not. The params for this function are expected to be numbers, so we shouldn't be doing any type coercion:

csrf/index.js

Lines 13 to 22 in 631884d

/**
* Token generation/verification class.
*
* @param {object} [options]
* @param {number} [options.saltLength=8] The string length of the salt
* @param {number} [options.secretLength=18] The byte length of the secret key
* @param {number} [options.validity=0] The maximum milliseconds of validity of this token. 0 disables the check.
* @param {boolean} [options.userInfo=false] Require userInfo on create() and verify()
* @public
*/

Checklist

Signed-off-by: Frazer Smith <frazer.dev@icloud.com>
@Fdawgs Fdawgs force-pushed the Fdawgs-patch-1 branch from e7df92a to c850a0e Compare May 4, 2025 15:09
@Fdawgs Fdawgs force-pushed the Fdawgs-patch-1 branch from c850a0e to 9124c93 Compare May 4, 2025 15:11
@Fdawgs Fdawgs merged commit b7515b9 into main May 6, 2025
14 checks passed
@Fdawgs Fdawgs deleted the Fdawgs-patch-1 branch May 6, 2025 16:03
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