Files
Nexus/docs/reports/2026-06-12-remote-browser-patrol.md
T

91 lines
4.0 KiB
Markdown
Raw Normal View History

# 巡查 — 远程浏览器 + 生产基线
**日期**2026-06-12
**范围**:生产 `api.synaglobal.vip`、Worker `66.154.115.131:8443`、工作区浏览器改动、审计 F1/F3 闭环
**关联审计**`docs/audit/2026-06-12-remote-browser-worker.md`
## 进度条
| 步骤 | 状态 |
|------|------|
| 生产 `/health` + prod_probe | ✅ 全通过 |
| 浏览器后端配置 | ✅ `BROWSER_ENABLED=1`Worker URL 已配 |
| 浏览器前端 bundle | ❌ **未部署** |
| Worker 可达 / 暴露面 | ⚠️ 公网可访问 `/health` |
| 审计 P1 闭环 | ❌ F1 SSRF、F3 防火墙未修 |
| 工作区 git | ⚠️ 浏览器源码 largely 未 commit |
| 本地单测 | ✅ browser 7 + watch_pins 9 = 16 passed |
## 生产探针(`scripts/prod_health_check.sh`
```text
✓ external /health → ok
✓ external /app/ → HTTP 200
✓ login / health/detail / alert-history / schedules / cron / main bundle
=== All production probe checks passed ===
```
容器:`nexus-prod-nexus-1` **Up ~4min (healthy)**(巡查时刚重启不久)。
## 远程浏览器链路
| 检查项 | 结果 | 说明 |
|--------|------|------|
| 主站 `/health` | `ok` | 公网 + 容器内均 OK |
| 容器 `settings.BROWSER_ENABLED` | `1` | Worker URL `http://66.154.115.131:8443` |
| 主站 → Worker `/health` | `ok` | 容器内 curl 成功 |
| 公网 → Worker `/health` | **可达** | `{"status":"ok","sessions":1,"max_sessions":2}` |
| 无 Key `POST /v1/sessions` | `422` | 非 401,但无密钥无法建会话 |
| 生产 `web/app``GlobalBrowser` / `ws/browser` / screencast | **无** | 146 个 JSgrep 零命中 |
| 侧栏「浏览器」/ 地球按钮 UI | **未上线** | 需 `vite build` + `sync_webapp_to_container.sh` |
**结论**:后端与 Worker **已启用**,但 **SPA 未同步**,管理员面板仍无远程浏览器入口;与「连不上」用户反馈一致(旧 bundle 无 canvas 客户端)。
## 审计项复查(未闭环)
| ID | 审计结论 | 巡查结果 |
|----|----------|----------|
| **F1** | 页内点击/重定向无 SSRF 复验 | **未修**`session_manager.py``NAVIGATE``validate_navigation_url` |
| **F3** | Worker `ufw` 过宽 | **未确认修** — 公网 curl `/health` 成功,8443 仍暴露;Worker SSH 本机无凭据 |
| F4 | delete 失败静默 | 未改 |
| F5 | 内存 session_registry | 可接受(单进程 Docker |
Worker 当前 **`sessions:1`**:可能存在陈旧会话占槽(`max_sessions=2`),建议 Worker 侧重启或调 API 清理。
## 工作区状态
浏览器相关文件多为 **未跟踪 / 未提交**`browser-worker/``GlobalBrowserPanel.vue``browser_session.py` 等)。生产后端已跑新镜像,但 **前端构建产物未进容器**,形成 **前后端版本错位**
本地:
```bash
pytest tests/test_browser_url_safe.py tests/test_browser_ui_state.py tests/test_watch_pins.py -q
16 passed
```
## 发现汇总
| # | 严重度 | 问题 | 建议 |
|---|--------|------|------|
| 1 | **P0 体验** | 前端未部署,用户无法使用浏览器 | `cd frontend && npx vite build``deploy/sync_webapp_to_container.sh` |
| 2 | **P1 安全** | Worker 8443 + `/health` 公网可见 | 收紧 ufw 仅 `20.24.218.235``/health` 加 Key 或禁公网 |
| 3 | **P1 安全** | F1 页内导航 SSRF 缺口 | `framenavigated` 逐跳校验 |
| 4 | P2 | Worker `sessions:1` 占槽 | 清理会话或等待 idle 超时 |
| 5 | P2 | 源码未 commit | 部署稳定后 `git add` 源码+文档(不含 `web/app/assets` 洪流) |
## 建议执行顺序
1. **同步前端**(解除 P0
2. **收紧 Worker 防火墙**F3
3. **实现 F1** 后复审计
4. **commit** 源码与 changelog/audit/report
## 验证命令(复巡)
```bash
bash scripts/prod_health_check.sh
ssh nexus 'sudo docker exec nexus-prod-nexus-1 python3 -c "from server.config import settings; print(settings.BROWSER_ENABLED)"'
ssh nexus 'sudo docker exec nexus-prod-nexus-1 grep -rl ws/browser /app/web/app/assets/ | head -1'
curl -s http://66.154.115.131:8443/health # 修 F3 后应仅主站可达
```