[Bug]: RegistryClient ignores credentials in HTTPS_PROXY, so image pulls fail with proxyAuthenticationRequired

Đang mở Phù hợp với người mới
#1,012 0 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 2 ngày

@vishalhabib99 đang làm issue này rồi.

Từ ngày 13/11/2026.

  • #1015 của @vishalhabib99 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
swift
Lĩnh vực
networking

Hướng nghiên cứu

Bắt đầu tại RegistryClient, nơi httpConfiguration.proxy được thiết lập từ host và port của proxy, rồi tìm nơi HTTPS_PROXY được đọc và phân tích. Chuyển username và password từ URL proxy vào HTTPClient.Configuration.Proxy.server(host:port:authorization:) bằng .basic(username:password:). Hoàn thành khi một yêu cầu qua proxy yêu cầu xác thực Basic gửi header Proxy-Authorization, và một URL proxy không có thông tin xác thực hoạt động như trước.

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

Mô tả

I have done the following
  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce

I reproduced this through container 1.7.1, which pins containerization at baf212e. The setup is the same as apple/container#2499: a user that has never used container, and a local proxy on 127.0.0.1:18080 that requires Basic auth with repro:secret. curl gets a 200 through the same proxy URL.

$ HTTPS_PROXY=http://repro:[email protected]:18080 container system start --disable-kernel-install
$ container image pull --progress plain docker.io/library/alpine:3.20
[1/2] Fetching image [43s]
Error: HTTPClientError.proxyAuthenticationRequired

The services that system start launches inherit HTTPS_PROXY, so the pull goes through the proxy. With the services started without the proxy, the same pull succeeds. It happens every time.

Current behavior

RegistryClient never sends a Proxy-Authorization header. It keeps only the proxy's host and port. The line is the same at baf212e and on main:

httpConfiguration.proxy = HTTPClient.Configuration.Proxy.server(host: proxyHost, port: proxyPort)
Current behavior

RegistryClient never sends a Proxy-Authorization header. It keeps only the proxy's host and port. The line is the same at baf212e and on main:

httpConfiguration.proxy = HTTPClient.Configuration.Proxy.server(host: proxyHost, port: proxyPort)
Expected behavior

The user and password in the proxy URL are sent as Basic proxy auth, as curl does with the same variable. AsyncHTTPClient accepts them with .server(host:port:authorization: .basic(username:password:)).

Environment
- OS: macOS 27.2 (26B123)
- Xcode: not installed (Command Line Tools 27.0)
- Swift: Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)
- Containerization: `baf212e`, through container CLI 1.7.1 (Homebrew)
Relevant log output
The proxy log shows 21 CONNECTs over about 40 seconds, none with credentials, although the proxy keeps the connection open after each 407:


23:33:15 CONNECT registry-1.docker.io:443 Proxy-Authorization=absent -> 407
...
23:33:53 CONNECT registry-1.docker.io:443 Proxy-Authorization=absent -> 407
Code of Conduct
  • I agree to follow this project's Code of Conduct
Ngôn ngữ chính
Swift
Star
9k
Fork
412
Merge trung bình
3 ngày 10 giờ
Pull request đã merge (30 ngày)
12

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 apple/containerization

Tất cả issue của apple/containerization

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.