GitLab login callback port lacks flexibility: high friction when port 8080 is occupied

Ouverte
#66,974 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
30/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
typescript
Domaine
authentication

Piste de recherche

Start in gitlab.ts, where the bundled GitLab OAuth redirect URI on port 8080 is hardcoded, and compare it with the callbackPort and callbackFallbackPort handling and bindWithRetry in openai.ts. The issue asks maintainers to choose a direction first, so confirm that before coding. Done means the callback port is configurable or falls back, and the 11 GitLab OAuth tests pass with 8080 occupied.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

area/auth type/feature version/v2

Current behavior

The bundled GitLab OAuth application is registered with the redirect URI http://127.0.0.1:8080/callback, and GitLab matches redirect_uri exactly, so the port cannot be ephemeral (as noted in gitlab.ts). When port 8080 is occupied on the user's machine — proxies and dev servers commonly are — login fails with:

"GitLab login needs local port 8080, but it is already in use. Stop the process using that port and try again."

Impact

The error message does offer an escape hatch — stop whatever occupies the port — but that is often impractical: the occupying process may be another project's dev server or a system proxy that the user cannot simply kill. For users who cannot patch the code and register their own OAuth application, the remaining options are all poor. We reproduced the underlying fragility: 11 GitLab OAuth tests fail in any environment where 8080 is taken.

Suggestions (three layers)

Quick win: support a GITLAB_OAUTH_CALLBACK_PORT (or similar) env var. Self-managed users can already override the client ID via GITLAB_OAUTH_CLIENT_ID, but the callback port stays hardcoded — so the escape hatch is incomplete today.

Permanent fix: the bundled application is instance-owned, so registering a fallback redirect URI (e.g. http://127.0.0.1:1457/callback) is entirely in this project's hands — the OpenAI provider already does exactly this (callbackPort 1455 + callbackFallbackPort 1457 in openai.ts).

Wiring: implement occupied-port detection with automatic fallback and retry (the bindWithRetry pattern already exists in openai.ts), so the fallback activates as soon as the extra redirect URI is registered — zero user action needed.

Lifecycle: the env-var escape hatch remains as a fallback after the permanent fix lands; it does not compete with it. Before the permanent fix ships, users still have a bridge.

Happy to hear maintainers' thoughts on the direction first — a test-side fix PR is ready to follow once aligned.

Langage dominant
TypeScript
Étoiles
230k
Forks
31.3k
Merge moyen
5 h 32 min
PR mergées (30 j)
453

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de anomalyco/opencode

Toutes les issues de anomalyco/opencode

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.