xtool auth login fails with HTTPClientError.connectTimeout after entering 2FA code on Linux (intermittent TLS stall to gsa.apple.com)

Đang mở
#414 1 bình luận 1 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
50/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
swift
Lĩnh vực
authentication, networking

Hướng nghiên cứu

Start by tracing xtool auth login from the 2FA submission through the sequential requests to gsa.apple.com; the payload does not name source files or tests. Check the HTTP client’s connection and TLS timeout handling and whether those requests can be retried safely. Done means intermittent stalls no longer force users to restart login, with retry behavior covered by an appropriate test.

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

Mô tả

Environment
  • xtool 1.24.0 (AppImage, x86_64)
  • Debian 13, Linux 6.12, Swift 6.4.2
  • Network: cloud VM behind a transparent proxy (fake-IP DNS, outbound HTTPS only)
Steps to reproduce
  1. xtool auth login
  2. Choose 1: Password
  3. Enter Apple ID and password; receive and enter the 2FA code
Actual result
Logging in...
Code: ******
Error: HTTPClientError.connectTimeout

xtool auth status still reports Logged out. Anisette provisioning had already succeeded (files written under ~/.config/xtool/data) and the 2FA code was delivered, so the first auth round worked.

Investigation
  • Every host used by the login flow was tested from the same machine: developerservices2.apple.com, idmsa.apple.com and mac-ani.jkcoxson.com (HTTPS and wss) always answered in about 0.15 s.
  • gsa.apple.com occasionally stalls right after the TLS ClientHello and never replies (curl stops at TLS handshake, Client hello). This happened in about 1 of 8 to 1 of 150 attempts.
  • After the 2FA step, the client makes several sequential requests to gsa.apple.com, so a single stall makes the whole login fail. Because the connect timeout is fixed at 60 s and there is no retry, the user has to start over and get a new 2FA code. Which request stalled could not be seen directly, so this part is an inference.
Workaround

I ran a small local CONNECT proxy that re-dials when the server has not sent a byte within 6 s (safe, because nothing has been received yet), and pointed xtool at it:

XTL_HTTP_PROXY=127.0.0.1:18080 XTL_DEBUG_ERRORS=1 xtool auth login

With it, login succeeded. In 300 test connections to gsa.apple.com through the proxy there were 0 failures, and one stall was recovered on retry. During the successful login itself no stall happened, so that run did not need the retry.

Suggestions
  • Retry the connection or TLS handshake (with a shorter per-attempt timeout) for idempotent auth requests, especially those after the 2FA code is submitted.
  • Optionally make the connect timeout configurable (e.g. XTL_CONNECT_TIMEOUT).
  • Document XTL_HTTP_PROXY / XTL_DEBUG_ERRORS in the README for users on restricted networks.
Ngôn ngữ chính
Swift
Star
5.5k
Fork
163
Merge trung bình
1 ngày 12 giờ
Pull request đã merge (30 ngày)
33

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 xtool-org/xtool

Tất cả issue của xtool-org/xtool

Issue tương tự

Thêm issue về Swift

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.