15 Commits
Author SHA1 Message Date
david-renaud-oktaandGitHub 44ce6fd923 fix!: Prevent accidental use of insecure key sizes & misconfiguration of secrets (#852)
* fix!: Disable use of weak RSA key sizes for asymmetric algorithms

Added checks to prevent invalid secrets from being used with the HS*** algorithms when signing and verifying
Added checks to prevent the use of insecure asymmetric key sizes except when explicitly overriden via options
Prevented Buffers containing malicious objects from being used as key material.

BREAKING CHANGE: Requires node 12.x or later to allow use of `KeyObject`
2022-11-29 11:58:59 -05:00
Jake LaceyandGitHub 59d32eeef4 fix(sign&verify)!: Remove default none support from sign and verify methods, and require it to be explicitly configured (#851)
* fix(sign&verify)!: Remove default none support from sign and verify methods, and require it to be explicitly configured

BREAKING CHANGE: Removes fallback for none algorithm for the verify method.
2022-11-29 14:32:41 +00:00
Tim OramandEduardo Diaz c86e573d16 Complete ESLint conversion and cleanup (#490)
* Add extension to ESLint config file

The .eslintrc file without an extension was deprecated a few years ago,
so this change renames the file to add the required extension.

See: https://github.com/eslint/eslint/commit/c9a8883d450d63a8d044a9e66d275f5b1973a3ba

* Add ESLint to package.json

This change adds ESLint as a dev-dependency and adds a lint script that
will run ESLint.

* Complete switch from JSHint to ESLint

Convert all the JSHint rules to the ESLint equivalents where possible.
The no-undef rule in ESLint caught a few cases of undefined usages in
the tests, so they were also fixed.

* Add a .eslintignore file

The HTML coverage report is currently being linted, which causes a lot
if invalid linting errors. This change adds a ignore file to ensure these
files are properly skipped during linting.
2018-06-25 19:54:04 +02:00
Eduardo Diaz d63c87dc7c add test & modify guard code 2017-08-17 13:50:26 +02:00
Eduardo Diaz 87d9e777ed Make Options object optional for callback-ish sign 2017-03-08 14:09:04 +01:00
Sergey MaslyakovandEduardo Diaz 047f1ae04b Raise jws.decode error to avoid confusion with "invalid token" error (#294)
* Corrected indistinguishable error messages

jws.decode() never throws an error. At least, in its current version. However, if it were to throw an exception, the diagnostics would be indistinguishable from a soft failure to decode a token. I had an extra trailing space on my JWT and it took me some additional debugging work to trace the actual root cause because the error message was not distinct.

* Allowed an exception from inside of jws.decode to be handled by the caller. Currently, jws.decode never throws an exception. The change is made per discsussion in the original PR

* Added a test case and proper forwarding of the possible exception thrown from jws.decode

* Typo correction
2017-02-09 13:54:58 +01:00
José F. Romaniello c7b3ab1946 remove broken test from bad merge 2015-03-06 12:01:49 -03:00
Ben Bradley 002cce17c0 Added option to ignore expirations in tokens 2014-12-22 12:02:04 -08:00
José F. Romaniello d380a1710e Merge branch 'master' of https://github.com/mprinc/node-jsonwebtoken into mprinc-master 2014-12-19 23:41:49 -03:00
Joshua Perry a135caacad Add support for aud array and scalar strings Fixes #33 2014-11-25 18:42:42 -07:00
Sasha Mile Rudan 9427f35512 Fixed bug in verify function with missing options and existing callback function 2014-11-15 00:17:50 +01:00
José F. Romaniello 01ba8a8443 do not throw exception when the payload is not json. related to #14 2014-09-15 11:50:50 -03:00
Marwan Hilmi f6e5e9d10d Verifying null fix. 2014-09-04 21:15:50 -07:00
Matias Woloski dfddaa4bf5 fix security bug. JWT with alg none should fail if secretOrPulblicKey is passed 2014-07-14 16:18:05 -03:00
Matias Woloski 07d163b2b1 initial 2013-06-30 22:27:13 -03:00