Skip to content

fix: correctly handle expired JWE's in cookies #2082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 14, 2025
Merged

Conversation

frederikprijck
Copy link
Member

📋 Changes

We ensured JWE's expire in #2040 , this has the side-effect that when an expired token hits the API, it would throw a 500 because it can not encrypt the JWE due to the expiration.

Instead of this, it should act as if there is no active session.

📎 References

#2081

🎯 Testing

  1. Obtain an expired JWT
  2. Hit the Next.js server wired up with the Auth0 middleware
  3. Boom, HTTP 500

@frederikprijck frederikprijck force-pushed the fix/handle-expired branch 3 times, most recently from f3c4154 to af39cb4 Compare May 8, 2025 22:27
@codecov-commenter
Copy link

codecov-commenter commented May 8, 2025

Codecov Report

Attention: Patch coverage is 96.07843% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.54%. Comparing base (a063a8d) to head (48aaa04).

Files with missing lines Patch % Lines
src/server/session/stateful-session-store.ts 93.75% 1 Missing ⚠️
src/server/session/stateless-session-store.ts 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2082      +/-   ##
==========================================
+ Coverage   84.23%   84.54%   +0.31%     
==========================================
  Files          22       22              
  Lines        2208     2233      +25     
  Branches      397      406       +9     
==========================================
+ Hits         1860     1888      +28     
+ Misses        342      339       -3     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@frederikprijck frederikprijck force-pushed the fix/handle-expired branch 3 times, most recently from dff77c5 to 8dc270f Compare June 16, 2025 17:25
@frederikprijck frederikprijck marked this pull request as ready for review July 3, 2025 17:21
@frederikprijck frederikprijck requested a review from a team as a code owner July 3, 2025 17:21
tusharpandey13
tusharpandey13 previously approved these changes Jul 9, 2025
Copy link
Contributor

@tusharpandey13 tusharpandey13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@tusharpandey13 tusharpandey13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@frederikprijck frederikprijck merged commit 15e7511 into main Jul 14, 2025
12 checks passed
@frederikprijck frederikprijck deleted the fix/handle-expired branch July 14, 2025 13:36
@mcgaryes
Copy link

Any idea when this might make it into a release?

Thanks in advance!

@brunoscopelliti
Copy link

Hi @frederikprijck
Thank you for this!
Do you have any idea when we can reasonably expect the next release of the package?

@tusharpandey13 tusharpandey13 mentioned this pull request Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants