未配置 root_api_key 时仅允许 localhost 绑定
fix(server): 未配置 root_api_key 时仅允许 localhost 绑定
未配置 root_api_key 时仅允许 localhost 绑定0251c7-fix-root-api-key-localhost-cve-2026-22207fixroot api key localhost server
Committed by qin-ctx
commit message
fix(server): 未配置 root_api_key 时仅允许 localhost 绑定
当 root_api_key 未配置时 resolve_identity() 将所有请求解析为 ROOT,
结合默认绑定 0.0.0.0 会导致任何网络请求均可执行管理员操作。
- 将默认 host 从 0.0.0.0 改为 127.0.0.1
- 添加 validate_server_config() 启动校验:无 key + 非 localhost 时拒绝启动
- 将 dev mode 日志从 info 升级为 warning
- 更新中英文认证文档的开发模式段落
Closes #302
Co-Authored-By: Claude Opus 4.6 <[email protected]>Editor assessment
This commit patches CVE-2026-22207. The Chinese subject states the exact behavioral rule: when root_api_key is unset, only localhost binding is allowed. The body then explains the underlying risk, namely that resolve_identity() maps every request to ROOT and the default 0.0.0.0 binding exposes admin operations to any network request. Four bullets cover the host default, a new startup validation that refuses to launch, the dev-mode log upgrade and documentation updates. Closes #302 is well formed and meaningful. The language is consistent, type and scope fit, and only the lack of a concrete attack example keeps it just short of exemplar.