Skip to content

Fix relative_url_root Web IDE OAuth issues

Cindy Halim requested to merge 475276-fix-relative-url-oauth into master

Issue: Web IDE OAuth: Handle relative url root case (#475276 - closed)

What does this MR do and why?

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

No relative URL With relative URL
Correct OAuth redirect URL no-relative.png relative.png
Incorrect OAuth redirect URL no-relative-mismatch.png relative-mismatch.png

How to set up and validate locally

Setup

  • Pull this branch and run yarn install

To test relative URL

  1. Stop GDK with gdk stop

  2. Add relative_url_root by running gdk config set relative_url_root /gitlab

  3. Disable vite by running:

    gdk config set webpack.enabled true
    gdk config set vite.enabled false
  4. Run gdk reconfigure

  5. In resulting Procfile, add -authBackend http://localhost:8080/gitlab to the end of the line that starts with gitlab-workhorse:

  6. Start GDK with gdk start

  7. Visit the GDK at /gitlab

To test Web IDE OAuth redirect URL mismatch

  1. Go to Admin Area
  2. Select `Applications` and select GitLab Web IDE. Edit the application settings' redirect URL and the one with origin matching your window origin.
  3. If you've recently accessed the Web IDE, be sure to remove the gitlab/web-ide/oauth/<application_id>/token entry from local storage.
  4. Open Web IDE, should see the error page.

To test fresh Web IDE setup

  1. Remove the GitLab Web IDE application in Admin Area.
  2. If you've recently accessed the Web IDE, be sure to remove the gitlab/web-ide/oauth/<application_id>/token entry from local storage.
  3. Open Web IDE

Cases I've tested (with relative URL and no relative URL):

  • Fresh Web IDE setup: correctly creates OAuth application with correct redirect URL matching the configs
  • Open Web IDE with matching redirect URLs: Web IDE works as expected
    • Can checkout branches
    • Can commit and create MR
    • Go to MR and go to project links work
    • We see the duo icon
    • No unexpected errors in dev console
  • Open Web IDE with mismatching redirect URLs:
    • See error page
    • If multiple domain listed, drop down is rendered
    • Suggested domains don't include one matching the current window origin
Edited by Cindy Halim

Merge request reports

Loading