-
Notifications
You must be signed in to change notification settings - Fork 143
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
Cookies Samesite attribute handling #322
Comments
Regarding 1) Experiencing the same issue, looks like the configuration for the cookie is being shared and there's no builtin way to override the behaviour: express-openid-connect/lib/context.js Lines 258 to 264 in b850bfd
|
Hi @surensinghkhatana - thanks for raising this
Currently the cookie config is shared for the session and transaction cookies. But your use case sounds like a reasonable one, so I'll keep this open as a possible enhancement.
You can configure the cookie name using the
The library doesn't provide csrf protection (other than the default cookie config SameSite=Lax). This is a separate concern from login and you should use one of the available express csrf protection middlewares if you want to add this. |
Thanks @adamjmcgrath for quick response. Appreciate your help.
I tried this `/home/ec2-user/bff-code/bff-layer/node_modules/express-openid-connect/lib/config.js:209
|
Ah - thanks for testing that @surensinghkhatana, when I pick up this ticket I'll look into that limitation as well |
Describe the problem
I have a SPA application that talks to the backend BFF layer (which handles all OAuth flows using express-openid-connect lib). I would like to set
samesite =strict
for the appSession cookie containing the tokens so that the cookie is protected and only sent to my BFF component.In order to achieve this , I have set the
cookieconfigparams
ascookie: { httpOnly: true, sameSite: 'Strict', secure: true }
but the problem is that this configuration also sets thesamesite =strict
forauth_verification
cookie as well. This prevents theauth_verification
cookie to be sent to the /callback since it is redirected from a third party auth server domain and that causes the following error :BadRequestError: checks.state argument is missing at /home/ec2-user/bff-code/bff-layer/node_modules/express-openid-connect/middleware/auth.js:121:31 at processTicksAndRejections (node:internal/process/task_queues:96:5)
I have following questions :
samesite =strict
for the encrypted cookie but keepsamesite =lax
for theauth_verification
cookie ?__Host-
for theappSession
cookie usingcookieconfigparams
?appSession
cookie containing the tokens ?The text was updated successfully, but these errors were encountered: