-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix: Don't store JWT token in an SSR environment #9848
fix: Don't store JWT token in an SSR environment #9848
Conversation
|
@devcshort is attempting to deploy a commit to the medusajs Team on Vercel. A member of the Team first needs to authorize it. |
@sradevski @olivermrbl @shahednasser can we ask for your review? This fix is really urgent for us. |
Looks fine to me. I will let @olivermrbl and @sradevski look into it once and especially the failing CI tests |
@olivermrbl @sradevski any updates on this? This is a fairly urgent request for us and is a prerequisite before we can go to production. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
Can we expect the fix in v1.20.11? |
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Not stale |
@olivermrbl @kasperkristensen what is your release cycle like? Curious when we can expect this change for the v1 Medusajs client to be released. Thanks! |
Being a security issue, they may release it to version 1 too. |
@devcshort, there is no release cycle for v1, since PRs are very rarely merged. We tend to do it shortly after this happens, so I expect to cut a new version later today. |
@olivermrbl sounds great, thank you for the update! |
What - This change makes it so that JWT doesn't get stored on the Medusa client when in an SSR environment.
Why - Currently when the Medusa client is used in an SSR environment, the last logged in user's JWT gets stored on the Medusa client. This causes customer information to be leaked when it shouldn't be.
How - To keep things DRY, I added a typeof check to the jwt-token-manager that checks if the window is undefined. If it's undefined, I'm simply just returning as I don't believe any further action is needed.
This fixes the issue referenced here #6889