Repository navigation
fix(ov_cli): trust native CA roots - #6361
Merged
Merged
Conversation
qin-ctx
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
本 PR 修复
ovCLI 无法信任操作系统已安装私有 CA 的问题。当前
ov_cli使用 reqwest 0.12,并关闭默认 feature 后仅启用rustls-tls。在该版本中,rustls-tls实际等价于rustls-tls-webpki-roots,因此 HTTP 客户端只加载内置的 Mozilla 公共根证书,不读取操作系统原生信任库,也不会处理SSL_CERT_FILE或SSL_CERT_DIR指定的证书。这会导致一个常见的自托管场景无法工作:公司内网或家庭局域网中的 OpenViking 服务使用 Caddy internal CA、企业内部 CA 等私有 CA 签发 HTTPS 证书。即使客户端机器已经信任该 CA,浏览器可以正常访问,
ov health和ov chat仍会因UnknownIssuer拒绝连接。本 PR 为 reqwest 增加
rustls-tls-native-rootsfeature。reqwest 会将系统原生根证书与现有 WebPKI 公共根证书合并到同一个 rustls root store,因此:ov使用;SSL_CERT_FILE和 Unix 上的SSL_CERT_DIR可以为命令提供自定义 CA;ov_cli中所有 reqwest client builder 生效,包括普通 API 请求、带独立连接超时的请求和ov chat,无需在多个构造点重复传递 CA 配置。Human Involvement
Related Issue
Fixes #6289
#6288 已单独修复 TLS 底层错误被隐藏的问题;本 PR 只处理 CA 信任来源,不重复修改错误展示逻辑。
Type of Change
Changes Made
crates/ov_cli/Cargo.toml的 reqwest features 中增加rustls-tls-native-roots,保留现有rustls-tls,使 native roots 与 WebPKI roots 同时加载。Cargo.lock,将rustls-native-certs纳入 reqwest 的已解析依赖。SSL_CERT_FILE和 UnixSSL_CERT_DIR的使用方式,并明确 TLS 证书校验不会被关闭。ca_cert配置字段,不修改现有 HTTP client 构造函数,不引入danger_accept_invalid_certs,也不把任何用户 CA 打包进ov。验收条件与实现对应关系:
ov health可连接rustls-native-certs加载操作系统原生信任库rustls-native-certs读取SSL_CERT_FILE/SSL_CERT_DIRov chat使用相同信任来源rustls-tls-webpki-rootsTesting
编译检查:
结果:通过,无新增编译错误或 warning。
依赖特性检查:
结果确认 reqwest 同时启用:
rustls-tls-webpki-rootsrustls-tls-native-rootsrustls-native-certs v0.8.3webpki-roots v1.0.6完整 Rust CLI 测试:
RUST_MIN_STACK=16777216 cargo test -p ov_cli结果:
513 passed, 0 failed4 passed, 0 failed当前
main上部分大型 Clap/help 测试在 macOS 默认测试线程栈下会发生 stack overflow,因此本地全量验证显式增大RUST_MIN_STACK;这不会改变被测代码或测试逻辑。静态检查:
结果:通过。
本地未搭建真实 Caddy/private CA OpenViking 服务做端到端连接测试;本次变更直接使用 reqwest 官方 native-roots feature,并通过最终 Cargo feature tree 验证 WebPKI roots 与 native roots 已同时进入
ov_cli。Checklist
本 PR 不修改 Rust 源码,因此没有需要新增注释的复杂逻辑。
rustls-native-certs已是已发布依赖,并由 reqwest feature 管理。Screenshots (if applicable)
不适用。本 PR 只调整 CLI TLS 根证书来源和文档,没有界面变化。
Additional Notes
这是有意保持最小范围的修复:系统或用户负责管理可信私有 CA,
ov只读取标准系统信任来源。若未来需要不同ovcli.confprofile 分别使用不同 CA,再单独评估显式ca_cert配置;该能力不属于本 Issue 的必要改动。