Skip to content
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

ui: force uses to sign-in page to fix SSO CSRF cookie issue (PROJQUAY… #865

Merged
merged 1 commit into from Aug 5, 2021

Conversation

syed
Copy link
Contributor

@syed syed commented Aug 5, 2021

…-2340)

This is because we use two different CSRF tokens for normal API calls
and OAUTH calls. The oauth token is set by the
/externallogin/<provider> endpoint and is set as an encrypted flask
cooke. However, v1 api calls set the cookie as a JWT token. The order of
API calls now makes a difference because the cookie from one gets
overwritten by the other.

When making the oauth call to the external provider. If we have the
wrong session cookie, the CSRF validation fails when the callback URL is
sent to the backend with the cookie containing the wrong CSRF token.

To fix this we must force users to go to the /signin page which makes
sure that the last API call that happens is the
/externallogin/<provider> which sets the correct cooke before
redirecting to the external provider

…-2340)

This is because we use two different CSRF tokens for normal API calls
and OAUTH calls. The oauth token is set by the
`/externallogin/<provider>` endpoint and is set as an encrypted flask
cooke. However, v1 api calls set the cookie as a JWT token. The order of
API calls now makes a difference because the cookie from one gets
overwritten by the other.

When making the oauth call to the external provider. If we have the
wrong session cookie, the CSRF validation fails when the callback URL is
sent to the backend with the cookie containing the wrong CSRF token.

To fix this we must force users to go to the `/signin` page which makes
sure that the last API call that happens is the
`/externallogin/<provider>` which sets the correct cooke before
redirecting to the external provider
@syed syed requested a review from kleesc August 5, 2021 17:28
@syed syed merged commit a180c52 into quay:master Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants