Cookie Referrer is not deleted after an OAUth redirect
- Customer / Requester: Big Consumer Electronic Company
- GitLab version: 7-14-stable-ee replicated in 8.1.2-ee
- Zendesk ticket: https://gitlab.zendesk.com/agent/tickets/10440
Description of issue
If you use GitLab as an OAuth provider, the following edge case can happen.
- First open a GitLab tab, but don't sign in there
- Open the Web App that has
omniauth-gitlab
for sign in and sign in there with your GitLab credentials - Then go into the already opened tab and sign in again there.
- You will be redirected to the App instead of the main GitLab dashboard
This happens, because the Web App sets a referrer to the OAUth callback URL, in order to properly authenticate. This referrer does not get deleted after the redirect, so it stays in the cookie, which the already opened tab reuses, thus redirecting the user back to the Web App instead of the GitLab dashboard.
Result of replication
Just as stated.
Concrete questions / Next steps
@DouweM and I had a quick chat about this on Slack, and it seems that we are simply not resetting or clearing the cookie before the redirect.
“Clearing the cookie” is really just passing along the “Set-Cookie” header with the response, no matter if the response is a “200 OK” or a “301 Redirect”
So we could just reset the cookie and send the 301 response.
@DouweM how much time do you think it would take to fix?
/cc @JobV