b866e944ab
Apply sync/install/auth/schedule/retry/agent/settings fixes from full code review; document accepted WS and Agent legacy risks for solo ops. Co-authored-by: Cursor <cursoragent@cursor.com>
1.8 KiB
1.8 KiB
2026-06-04 — Code Review P1/P2 修复批次 2
摘要
接续 P0/P1 批次,修复 WebSSH tv 校验、retry/schedule 行级锁、Agent fail-closed、Bing 壁纸 DoS、安装 status 隐藏及前端静默错误。
动机
全量 review 剩余项:WebSSH 与 access token 策略不一致;多 worker 重复 retry/schedule;Agent DB 异常误回退全局 Key;公开 Bing API 可被滥用拉取外网;多页面加载失败无提示。
涉及文件
| 区域 | 文件 |
|---|---|
| 认证 | auth_service.py(WebSSH JWT 含 tv)、webssh.py(校验 tv) |
| Agent | agent.py(DB 查服失败 reject) |
| 壁纸 | settings.py(GET 只读缓存 + POST sync 需 JWT) |
| 安装 | install.py(锁定后 /status 404) |
| 后台 | retry_runner.py(SKIP LOCKED + running→pending)、schedule_runner.py(FOR UPDATE + _schedule_is_due) |
| 前端 | useServerList.ts、CredentialsPage.vue、ScriptsPage.vue、CommandsPage.vue、DashboardPage.vue |
| 测试 | test_retry_runner_outcome.py |
行为变更
- 登录页壁纸:
GET /settings/bing-wallpapers仅返回本地缓存;管理员登录后 Dashboard 调用POST /settings/bing-wallpapers/sync更新。 - WebSSH:新签发的 token 含
tv;旧 token 仍走updated_at宽限。 - 安装完成:
GET /api/install/status在锁定后返回 404。
迁移 / 重启
- 重启
nexusSupervisor 服务。 - 前端重新
vite build部署。
验证
.venv/bin/ruff check server/...
.venv/bin/python -c "import server.main"
.venv/bin/pytest tests/test_security_unit.py tests/test_retry_runner_outcome.py -q
cd frontend && npm run type-check
进度:☑实现 ☑WSL验证 ☑审计8步 □部署 □健康检查 □浏览器验证 ☑changelog