You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was an issue found during the work I did for #497.
What
When passing an empty string to "notBefore". it throws a val is not a non-empty string or a valid number. val="" from the ms library. I would expect this to throw '"notBefore" should be a number of seconds or string representing a timespan' which is the same error as other invalid inputs.
/home/mitmaro/jwt-test/node_modules/jsonwebtoken/sign.js:98
throw err;
^
Error: "notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60
at Object.module.exports [as sign] (/home/mitmaro/jwt-test/node_modules/jsonwebtoken/sign.js:153:22)
at Object.<anonymous> (/home/mitmaro/jwt-test/test.js:2:5)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
Actual Output
/home/mitmaro/test/node_modules/jsonwebtoken/node_modules/ms/index.js:34
throw new Error(
^
Error: val is not a non-empty string or a valid number. val=""
at module.exports (/home/mitmaro/jwt-test/node_modules/jsonwebtoken/node_modules/ms/index.js:34:9)
at module.exports (/home/mitmaro/jwt-test/node_modules/jsonwebtoken/lib/timespan.js:7:24)
at Object.module.exports [as sign] (/home/mitmaro/jwt-test/node_modules/jsonwebtoken/sign.js:151:19)
at Object.<anonymous> (/home/mitmaro/jwt-test/test.js:2:5)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
The text was updated successfully, but these errors were encountered:
MitMaro
changed the title
Passing empty string to "notBefore" option gives non-standard error
Passing empty string to "notBefore" and "expiresIn" option gives non-standard error
Jun 26, 2018
This was an issue found during the work I did for #497.
What
When passing an empty string to "notBefore". it throws a
val is not a non-empty string or a valid number. val=""
from thems
library. I would expect this to throw'"notBefore" should be a number of seconds or string representing a timespan'
which is the same error as other invalid inputs.Test Case
Expected Output
Actual Output
The text was updated successfully, but these errors were encountered: