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

Đang mở
#66,974 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
authentication

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
230k
Fork
31.3k
Merge trung bình
5 giờ 32 phút
Pull request đã merge (30 ngày)
453

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode

Tất cả issue của anomalyco/opencode

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.