Skip to content

Commit

Permalink
fix(auth): do not allow without-expiration tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
sg-gs committed Jun 12, 2024
1 parent cff5733 commit 68f00d0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/config/initializers/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ module.exports = (App, Config) => {
*/
Passport.use(
new JwtStrategy(passportOpts, (payload, done) => {
const tokenWithoutExpiration = !payload.exp;

if (tokenWithoutExpiration) {
return done(new Error('Invalid token, sign in again'));
}

/* Temporal compatibility with old JWT
* BEGIN
*/
Expand Down

0 comments on commit 68f00d0

Please sign in to comment.