Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Not compatible with express-jwt 6 #22

Open
krazyjakee opened this issue Jun 30, 2020 · 2 comments
Open

Not compatible with express-jwt 6 #22

krazyjakee opened this issue Jun 30, 2020 · 2 comments

Comments

@krazyjakee
Copy link

express-jwt 6 requires an algorithm to be explicitly specified.

See here: https://stackoverflow.com/questions/62665636/if-options-algorithms-throw-new-erroralgorithms-should-be-set-error-alg

@Wenish
Copy link

Wenish commented Jul 1, 2020

@krazyjakee can you maybe write a little bit more about youre issue then just a stackoverflow link?

@krazyjakee
Copy link
Author

krazyjakee commented Jul 1, 2020

@Wenish wow, what a terrible ticket! I'm sorry, it was late, that's the only excuse I have 😄

I see you have a dependency (and peer dependency) of "express-jwt": "^5.3.1". There is a critical severity security issue on all versions prior to 5.3.3 here: GHSA-6g6m-m6h5-w9gf
It's patched in v6.0.0, however, that version explicitly requires you to supply an algorithm like so...

expressJwt({ secret:  process.env.JWT_SECRET, algorithms: ['SHA256'] });

This is missing currently:

const jwtMiddleware = jwt({
secret: JWT_SECRET,
userProperty: "cauth",
getToken: function (req) {
if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
return req.headers.authorization.split(' ')[1];
} else if (req.query && req.query.token) {
return req.query.token;
}
return null;
}
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants