# 审计 — 检测路径改为 nginx 网站目录 ## 范围(文件清单) | 文件 | 变更 | |------|------| | `server/utils/nginx_path_detect.py` | 新增:构建远程 nginx root 检测命令 | | `server/application/server_batch_common.py` | `detect_and_save_target_path` 改用 nginx | | `frontend/src/pages/ServersPage.vue` | 确认对话框文案 | | `scripts/batch_detect_target_path.py` | 脚本说明 | | `tests/test_nginx_path_detect.py` | 单元测试 | | `tests/test_server_onboarding.py` | mock 错误文案 | | `server/application/services/btpanel_service.py` | 同批部署:宝塔临时登录 TTL | | `server/infrastructure/btpanel/constants.py` | 同上 | | `server/infrastructure/btpanel/ssh_login.py` | 同上 | | `tests/test_btpanel_temp_login_ttl.py` | 同上 | ## Step 3 规则扫描 | H | 规则 | 结论 | |---|------|------| | H1 | 远程命令 domain 须 `shlex.quote` | PASS | | H2 | 解析路径走 `normalize_remote_abs_path` | PASS | | H3 | 非 root SSH 仍 `sudo_wrap` | PASS | | H4 | 未静默吞 SSH 错误 | PASS — 无 stdout 返回明确错误 | ## Closure | H | 判定 | 依据 | |---|------|------| | H1 | SAFE | `nginx_path_detect.py` `shlex.quote(host)` | | H2 | SAFE | `server_batch_common.py` normalize 后写入 | | H3 | SAFE | 沿用既有 `sudo_wrap` | | H4 | SAFE | `未找到 nginx 网站目录` | ## DoD - [x] pytest tests/test_nginx_path_detect.py - [x] changelog 2026-06-23-detect-path-nginx-root.md - [x] 功能指南 § 检测目标路径 已更新 ## 验证 ```bash pytest tests/test_nginx_path_detect.py tests/test_server_onboarding.py -q ```