Seed GitLab-provided OAuth applications

What does this MR do and why?

  • What? Introduces GitLab-provided OAuth applications for GitLab CLI, GitLab Duo for JetBrains, and GitLab for VS Code extension targeting GitLab instances.
  • Why? To remove the need for administrators creating an application and separately having users define the client ID for users.
Click to expand

This MR adds a one-time migration that creates instance-wide OAuth applications for the GitLab CLI (glab), the GitLab Workflow extension for VS Code, and the GitLab Duo plugin for JetBrains IDEs.

The applications use the same client IDs as GitLab.com, so these tools can sign in to a GitLab Self-Managed or Dedicated instance without an administrator creating an application and configuring a client ID first. The applications are public (no client secret) and not trusted, so users still see the consent screen.

The migration skips any application whose client ID already exists, so it never overwrites an administrator's edits. The editor integrations request api. glab requests openid profile read_user write_repository api, and GitLab rejects authorize requests outside an application's scopes, so its application carries all five.

Not in this MR: a per-application admin toggle, the Duo CLI application (it needs a GitLab.com application first), and the client fallback for instances without these applications.

References

Screenshots or screen recordings

Not applicable, no UI changes.

How to set up and validate locally

  1. Run the migration: bundle exec rake db:migrate.
  2. In a Rails console, list the seeded applications:
    Authn::OauthApplication.where(uid: %w[
      41d48f9422ebd655dd9cf2947d6979681dfaddc6d0c56f7628f6ada59559af1e
      36f2a70cddeb5a0889d4fd8295c241b7e9848e89cf9e599d0eed2d8e5350fbf5
      732efe7d78ba62b01d2a95cd3b02f3ca2a00c7cec32c01e060c1b7664a9aa367
    ]).pluck(:name, :scopes, :trusted, :confidential)
  3. Visit Admin > Applications and confirm the three applications are listed.

MR acceptance checklist

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

🤖 Generated with Claude Code

Edited by Erran Carey

Merge request reports

Loading
Loading