Cancellation of github repo import forwards to gitlab user profile "auth"

What's the bug behaviour

when trying to import a github project, but cancelling the workflow you get redirected to gitlab.com/auth, which is a gitlab user and not an authentication callback page, probably due to a configuration mismatch.

this might be misleading for some users and is probably only a minor issue, however technically the user "auth" could use the profile feature to display fake information that might mislead unexperienced gitlab users into thinking it is an official page

Steps to reproduce:

  1. "import project" ( https://gitlab.com/projects/new#import_project )
  2. "github" (while NOT having gitlab as an authorized oauth app in github (https://github.com/settings/applications)
  3. press "cancel" on the github oauth authorization page https://github.com/login/oauth/authorize

OR

  1. Sign out from GitLab
  2. Go to the login page (https://gitlab.com/users/sign_in)
  3. Click the GitHub button and enter your GH login and password if required
  4. Click the Cancel button on the Authorize GitLab.com page

you will then get redirected to gitlab.com/auth

Screenshot_2022-01-11_at_20.52.47

What is correct behaviour

After the presses "cancel" on the GitHub oauth authorization page, they should be redirected back to the project/new#import_project page.

Possible fixes

Implement additional redirect from https://gitlab.com/users/auth?error=access_denied&state=xyz to the project/new#import_project page. Utilize the state parameter to distinguish between import and non-related import OAuth (or even better - provide "return url" inside state and perform proper redirect "fixing" GitHub bug)

Edited by Tetiana Zavediuk