[Bug] Default PyPI mirror disables TLS certificate verification for plugin dependencies
Maintainer thường phản hồi trong vòng 1 ngày
Đá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
- 72/100
Hướng nghiên cứu
Đọc PipInstaller._build_pip_args() và các bài kiểm thử cho test_install_adds_aliyun_trusted_host_only_for_aliyun_index; issue cho biết cần cập nhật cả hai. Xóa hành vi trusted-host tự động, đồng thời giữ lại đối số index đã cấu hình, sau đó kiểm tra xem các trường hợp index mặc định và index tùy chỉnh đã được bao phủ chưa. Issue cũng yêu cầu làm rõ gợi ý pip_install_arg trong tất cả locale của dashboard.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
While following up on #10669 / #10670 and reviewing AstrBot's TLS handling, I found that the in-process pip installer disables TLS certificate verification for the default PyPI mirror.
PipInstaller._build_pip_args() appends --trusted-host mirrors.aliyun.com whenever the configured index is the default https://mirrors.aliyun.com/pypi/simple/. --trusted-host makes pip accept any certificate for that host, so an on-path attacker can present a self-signed certificate for mirrors.aliyun.com, serve crafted wheels, and get arbitrary code execution in the AstrBot process when plugin dependencies are installed. The default configuration is affected.
This is independent of the eMudhra CA incident from #10669 / #10670: the attack does not require a compromised CA key, only a network position and a certificate that pip would normally reject.
Reproduction Steps
-
Use AstrBot v4.29.1 with the default configuration (
pypi_index_urldefaults tohttps://mirrors.aliyun.com/pypi/simple/). -
Install a plugin that declares dependencies, or otherwise trigger
PipInstaller(plugin dependency install/update). -
The pip argv logged by the installer contains
--trusted-host mirrors.aliyun.com:Pip package manager argv: install -r requirements.txt --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple/ -
With an on-path proxy that terminates TLS for
mirrors.aliyun.comusing a self-signed certificate, pip accepts the connection and packages are downloaded without certificate verification. The packages are then installed and imported by plugins, which leads to arbitrary code execution.
Expected result: pip verifies the TLS certificate of the configured PyPI index, just like it does for any other HTTPS endpoint.
Actual result: Certificate verification is explicitly disabled for the default mirror.
AstrBot Version
v4.29.1 (master@0cd42bd4d)
Operating System
Linux
Deployment Method
Any (Docker, CLI, Windows Desktop)
Message Platform Adapter
N/A
Error Log
No error is raised; the insecure behavior is silent. The flag is visible in the generated pip argv, for example:
Pip package manager argv: install -r requirements.txt --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple/
Supplementary Information
History / source of this problem
--trusted-host mirrors.aliyun.comwas introduced in f8949ebea (2024-08-11, "perf: reboot after installing plugin") as a compatibility workaround when AstrBot switched its internal pip to the Aliyun mirror.- 3756cb766 (2025-04-14, "支持自定义 PyPI 软件仓库地址", fixes #1165) kept the flag while making the PyPI index configurable; #1165 itself was only about not defaulting overseas users to the Aliyun mirror.
- The current Aliyun-only special case was added in #5954 (6da59cfb0, 2026-03-11), together with tests that codified the behavior (
test_install_adds_aliyun_trusted_host_only_for_aliyun_index).
Why it can be removed now
- The current
mirrors.aliyun.comcertificate chain is anchored atGlobalSign Root R46, which is already included in certifi 2025.4.26 (the previous floor) and later versions. - I verified that both pip 25.0.1 (vendored certifi 2024.08.30) and pip 26.2.2 can install from
https://mirrors.aliyun.com/pypi/simple/without--trusted-host. - #10670 raises the floors to
certifi>=2026.10.19andpip>=26.2.2(pip 26.2.2 vendors certifi 2026.10.19), so fresh installs/updates will have a modern trust store. - Users with self-signed/private-CA mirrors keep an explicit migration path through
pip_install_arg(--cert /path/to/ca.pemrecommended, or explicit--trusted-host <host>); the same applies to plain-HTTP mirrors.
Proposed fix
Remove the automatic --trusted-host and the _get_trusted_host_for_index_url() helper from PipInstaller._build_pip_args(), keep the -i <index_url> argument, update the related tests, and clarify the pip_install_arg hint in all dashboard locales. I will submit a PR for this.
Checklist
- I have searched the Issue list for related issues and could not resolve the problem, or this issue has never been reported before.
- I have tried disabling all plugins to rule out issues caused by plugins.
- The issue I am reporting is related to AstrBot itself, not to a specific plugin.
- I have read and agree to the project's Code of Conduct.
- (Optional) I am willing to submit a PR to help fix this issue.
- Ngôn ngữ chính
- Python
- Star
- 42.1k
- Fork
- 3.1k
- Merge trung bình
- 1 ngày 50 phút
- Pull request đã merge (30 ngày)
- 146
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của AstrBotDevs/AstrBot
-
[Bug] 现实世界时间感知文案需要更新Có thể đã có người làm @mantoujun12 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
AstrBotDevs/AstrBot#10682 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Discord slash command sync aborts with KeyError when a plugin handler is defined in a submoduleCó thể đã có người làm @yuexia5 đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
AstrBotDevs/AstrBot#10626 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] QQ频道消息无法回复:markdown 回退顺序有误,误用主动消息导致 304049 限频Có thể đã có người làm @he-yufeng đã nhận 16 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
AstrBotDevs/AstrBot#10420 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature] 移除「切换到旧版知识库」入口Có thể đã có người làm @lingyun14beta đã nhận 12 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
AstrBotDevs/AstrBot#10340 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
AstrBotDevs/AstrBot#10322 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của AstrBotDevs/AstrBot
Issue tương tự
-
type-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
push_gh-pages fails on master branch on forksCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởgood first issue infrastructure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
kuznia-rdzeni/coreblocks#1135 ·
-
good first issue server
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation priority: high
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
a-lex-s/mealie-telegram-bot#54 ·
Maintainer thường phản hồi trong vòng 1 ngày