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

Aberta
#66,974 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
30/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
typescript
Domínio
authentication

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
230k
Forks
31.3k
Merge médio
5h 32min
PRs com merge (30d)
453

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de anomalyco/opencode

Todas as issues de anomalyco/opencode

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.