145 Commits
Author SHA1 Message Date
José F. Romaniello 815a1a1663 5.0.3 v5.0.3 2015-07-15 08:57:57 -03:00
José F. Romaniello 61ff117227 minor 2015-07-15 08:57:50 -03:00
José F. Romaniello 9039cf0ba0 Merge branch 'chncdcksn-fix-this-undefined' 2015-07-15 08:55:27 -03:00
Chance Dickson 93f554312e Fix this referring to the global object instead of module.exports in verify() 2015-07-09 08:03:15 -04:00
Damian Schenkelman 33b326fb1d Merge pull request #98 from adam-back/patch-1
Fix typo, line 139 README, complete option for .decode.
2015-06-17 19:31:18 -05:00
Adam Back 59c110aeb8 Fix typo, line 139 README, complete option for .decode. 2015-06-17 16:05:37 -07:00
José F. Romaniello 118ff1a7ba 5.0.2 v5.0.2 2015-06-15 07:26:33 -05:00
José F. Romaniello 170dc0787d Merge pull request #88 from dbrugne/master
Avoid uncaught "SyntaxError: Unexpected token ͧ" error.
2015-06-15 07:26:01 -05:00
José F. Romaniello 3d3413221f fix typo in docs . closes #86 2015-05-19 10:45:44 -03:00
Jared Hanson 214b9c435f Bump version to 5.0.1. v5.0.1 2015-05-15 15:00:30 -07:00
Damian Schenkelman 53dd3c36e7 Merge pull request #89 from jaredhanson/decode-complete
Add option to return header and payload when decoding.
2015-05-15 17:42:16 -03:00
Jared Hanson ba3174d100 Fix example in README, silence verbose logging. 2015-05-15 13:36:10 -07:00
Jared Hanson 851bda2b10 Immediate return if not decoded. 2015-05-15 11:48:10 -07:00
Jared Hanson ec32b20241 Document complete option in README. 2015-05-15 11:31:17 -07:00
Jared Hanson 7254e011b5 Add option to return header and payload when decoding. 2015-05-15 09:37:58 -07:00
dbrugne 0dc59cd6ee Avoid uncaught "SyntaxError: Unexpected token ͧ" error.
When .verify() a corrupted JWS (e.g.: malicious user add extra characters in the middle of token) an error is thrown:

``
[ERROR] console - SyntaxError: Unexpected token ͧ
    at Object.parse (native)
    at Object.jwsDecode [as decode] (/www/socketio-jwt/node_modules/jsonwebtoken/node_modules/jws/lib/verify-stream.js:71:20)
    at Object.module.exports.verify (/www/socketio-jwt/node_modules/jsonwebtoken/index.js:120:26)`
 ``
2015-05-07 11:32:59 +02:00
Alberto Pose 881d07f672 Merge pull request #81 from jas/master
Fix link to auth0.com in README
2015-04-19 16:45:52 -03:00
Jason Sandmeyer 1b3c5ff72c Fix link to auth0.com in README 2015-04-19 13:43:21 -04:00
Alberto Pose 927cce0dad Update CHANGELOG.md 2015-04-11 15:05:08 -03:00
Alberto Pose 6879e0fdde Update CHANGELOG.md 2015-04-11 15:04:05 -03:00
Alberto Pose c5596c10e8 Update CHANGELOG.md 2015-04-11 14:20:08 -03:00
Alberto Pose 07541f0315 Update CHANGELOG.md 2015-04-11 14:19:22 -03:00
Alberto Pose e6465d48dd Update CHANGELOG.md 2015-04-11 14:18:56 -03:00
Alberto Pose db8fb93ad7 5.0.0 v5.0.0 2015-04-10 17:48:02 -03:00
Alberto Pose e900282a8d Merge pull request #75 from auth0/dschenkelman-patch-1
Only set iat if there is none
2015-04-10 17:39:25 -03:00
Damian Schenkelman 634b8ed0ff Merge pull request #78 from auth0/update-to-jws-3
Update to jws@^3.0.0
2015-04-10 15:02:37 -03:00
Alberto Pose 9f24ffd579 Renaming header.alg mismatch exception to invalid algorithm and adding more mismatch tests. 2015-04-10 14:53:42 -03:00
Alberto Pose 19e6cc6a1f Adding @dschenkelman feedback. 2015-04-10 13:54:03 -03:00
Alberto Pose 1e46234201 Updating to jws@^3.0.0
As `[email protected]` changed the verify method signature to be `jws.verify(signature, algorithm, secretOrKey)`, the token header must be decoded first in order to make sure that the `alg` field matches one of the allowed `options.algorithms`. After that, the now validated `header.alg` is passed to `jws.verify`

As the order of steps has changed, the error that was thrown when the JWT was invalid is no longer the `jws` one:

{ [Error: Invalid token: no header in signature 'a.b.c'] code: 'MISSING_HEADER', signature: 'a.b.c' }

That old error (removed from jws) has been replaced by a `JsonWebTokenError` with message `invalid token`. That's why this change will bump be a major.
2015-04-10 12:38:41 -03:00
Damian Schenkelman 35036b188b Only set iat if there is none
Makes sense?
2015-04-07 13:43:07 -03:00
Alberto Pose 954bd7a312 Update CHANGELOG.md 2015-04-06 09:22:31 -03:00
Alberto Pose 24a370080e Update CHANGELOG.md 2015-04-06 09:21:39 -03:00
Alberto Pose a77df6d49d Documenting verify algorithms parameter. 2015-04-06 09:10:14 -03:00
José F. Romaniello e46ca66344 4.2.2 v4.2.2 2015-03-26 16:44:53 -03:00
José F. Romaniello 402794663b Merge pull request #71 from awlayton/fix-begin-public-rsa
Fix verify for RSAPublicKey formated keys
2015-03-26 16:43:53 -03:00
Alex Layton 8df6aabbc7 Fix verify for RSAPublicKey formated keys 2015-03-26 13:52:13 -04:00
José F. Romaniello 4d22d08da2 4.2.1 v4.2.1 2015-03-17 13:17:03 -03:00
José F. Romaniello 7017e74db9 fix issue when public key start with BEING PUBLIC KEY. closes #70 2015-03-17 13:16:12 -03:00
José F. Romaniello 7863a84b1d 4.2.0 v4.2.0 2015-03-16 20:38:43 -03:00
José F. Romaniello c2bf7b2cd7 Merge pull request #69 from auth0/fix_alg_vuln_on_verify
Verification with an asymmetric key of a token signed with a symmetric key
2015-03-16 20:38:21 -03:00
José F. Romaniello 1bb584bc38 Verification with an asymmetric key of a token signed with a symmetric key
There is a vulnerability in this module when the verification part is expecting a token digitally signed with an asymetric key (RS/ES family) of algorithms but instead the attacker send a token digitally signed with a symmetric algorithm (HS* family).

The issue is because this library has the very same signature to verify both type of tokens (parameter: `secretOrPublicKey`).

This change adds a new parameter to the verify called `algorithms`. This can be used to specify a list of supported algorithms, but the default value depends on the secret used: if the secretOrPublicKey contains the string `BEGIN CERTIFICATE` the default is `[ 'RS256','RS384','RS512','ES256','ES384','ES512' ]` otherwise is `[ 'HS256','HS384','HS512' ]`.
2015-03-16 20:36:22 -03:00
José F. Romaniello f9f3c34f84 fix commit links in changelog 2015-03-16 08:46:35 -03:00
José F. Romaniello 316fa4a4b8 add changelog. closes #67 2015-03-16 08:39:26 -03:00
José F. Romaniello b69d441c6e 4.1.0 v4.1.0 2015-03-10 14:00:09 -03:00
José F. Romaniello 2217e0b87d Merge branch 'abalmos-json-claim-set' 2015-03-10 13:59:52 -03:00
José F. Romaniello 3b0d0b6160 add one more test 2015-03-10 13:59:38 -03:00
Andrew Balmos 5290db1bd7 First assume JWT claim set is an object
draft-ietf-oauth-json-web-token does not require JWT objects to have typ: "JWT"
in their header. Yet it expects that the JWT's claim set be JSON for validation.
See step 10 of draft-ietf-oauth-json-web-token section 7.2 "Validating a JWT".

Prior to this commit JWTs without typ: "JWT" in header are validated without
ever checking the claim set.
2015-03-06 16:33:05 -05:00
José F. Romaniello db1cb1c864 4.0.0 v4.0.0 2015-03-06 12:10:44 -03:00
José F. Romaniello dd156cc30f add expiresInSeconds option to sign. closes #51 2015-03-06 12:08:38 -03:00
José F. Romaniello c7b3ab1946 remove broken test from bad merge 2015-03-06 12:01:49 -03:00