Files
Nexus/docs/changelog/2026-06-04-code-review-p1-p2-batch2.md
T
2026-07-08 22:31:31 +08:00

1.8 KiB
Raw Blame History

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/scheduleAgent DB 异常误回退全局 Key;公开 Bing API 可被滥用拉取外网;多页面加载失败无提示。

涉及文件

区域 文件
认证 auth_service.pyWebSSH JWT 含 tv)、webssh.py(校验 tv
Agent agent.pyDB 查服失败 reject
壁纸 settings.pyGET 只读缓存 + POST sync 需 JWT
安装 install.py(锁定后 /status 404
后台 retry_runner.pySKIP LOCKED + running→pending)、schedule_runner.pyFOR UPDATE + _schedule_is_due
前端 useServerList.tsCredentialsPage.vueScriptsPage.vueCommandsPage.vueDashboardPage.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。

迁移 / 重启

  • 重启 nexus Supervisor 服务。
  • 前端重新 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