-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[server] Set JWT cookie on sign-in WEB-100 #17200
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
Conversation
started the job as gitpod-build-mp-server-jwt-session-2.1 because the annotations in the pull request description changed |
d87a326
to
45b858d
Compare
4354107
to
cb1bd27
Compare
dcebc39
to
6f8ae73
Compare
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 so far. Just two remarks:
- SameSite setting of the cookie
- Issuer to be URI, not just hostname
response.cookie(SessionHandlerProvider.getJWTCookieName(this.config.hostUrl), token, { | ||
maxAge: this.config.session.maxAgeMs, | ||
httpOnly: true, | ||
sameSite: "lax", |
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.
Let's use strict
cookies, please.
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.
This matches the current cookie setting which we issue for session cookie. (it actually also marks the cookie as "secure" which we don't do currently)
Do you know the exact implications of changing this to strict?
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.
A strict cookie means, that if the browser (already received the cookie) is redirected to a 3rd party, and then back to Gitpod, the cookie will not be sent. This is a typical scenario for redirect-based flows, where the 3rd party knows some sort of "returnTo" URL to redirect back, e.g. after asking user for consent.
Hmm, now having that said, it sounds like we'd break Git Integrations with that. There are (at least) two solutions available:
- using a state param and a nonce cookie for redirect-based flows, similar to what's now done for OIDC SSO. There we no longer rely on a session.
- use a trick to relax the cookie for the time of a web-flow cycle: Make Gitpod cookie "stricter" #16406
That's getting to complicating here, I guess.
So, not raising the bar here seems ok, but keep in mind that we need to make it strict eventually to improve the security posture.
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.
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!
/unhold |
Description
On succesful sign-in, a JWT cookie is generated and stored in the client session.
Feature is behind a feature flag.
Related Issue(s)
How to test
_jwt_
suffixRelease Notes
Documentation
Build Options:
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish Options
Installer Options
Add desired feature flags to the end of the line above, space separated
Preview Environment Options:
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
/hold