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

未关闭 适合新手
#1,012 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@vishalhabib99 已经在做这个了。

开始于 2026年11月13日。

  • #1015 来自 @vishalhabib99 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
swift
领域
networking

调研方向

从 RegistryClient 开始,那里的 httpConfiguration.proxy 由代理主机和端口设置。找到 HTTPS_PROXY 被读取和解析的位置。使用 .basic(username:password:),将代理 URL 中的用户名和密码传入 HTTPClient.Configuration.Proxy.server(host:port:authorization:)。当经过需要 Basic 认证的代理的请求发送 Proxy-Authorization 请求头,并且不带凭据的代理 URL 行为与之前一致时,即完成。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
Swift
星标
9k
派生
412
平均合并
3 天 10 小时
30 天内合并 PR
12

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apple/containerization 的其他 Issue

查看 apple/containerization 的全部 Issue

相似的 Issue

更多 Swift Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。