Files
story/docs/tencent-captcha-csp-fix-20260920.md
Codex Local bf1233d5df
ci / verify (push) Canceled after 0s
feat: expand companion platform, device controls, and memoir workflows
Add customer and operator login, BLE provisioning, device fleet controls, call memory, memoir generation, and refreshed family and maintenance portals. Include API contracts, migrations, firmware sources, tests, assets, and deployment documentation.
2026-10-08 10:06:44 +08:00

37 lines
2.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SaaS 验证码弹窗修复(2026-09-20)
## 结果
2026-09-20 22:22(Asia/Shanghai)发布 Web 镜像 `data-terminal-cloud-web:0.98.2-rc.captcha-csp1`。已在真实线上 `/login` 密码登录页面检查:点击登录后显示腾讯云滑块拼图,取消后显示“已取消验证”。未完成拼图、未发送短信,不声称真实票据验证及账号登录全流程已验证。
## 根因与改动
旧 CSP 仅允许腾讯云入口脚本,未允许验证码 2.0 动态加载的 CDN 脚本、样式和 blob worker。隔离诊断页复现到以下拦截:
- `style-src-elem`:`turing.captcha.gtimg.com/1/tgJCapCss.*.css` 及 `turing.captcha.qcloud.com` 样式回退。
- `script-src-elem`:`turing.captcha.gtimg.com/1/dy-jy3.js`、`tgJCap.*.js`。
- `worker-src`:`blob:`。
仅向 style-src 添加 `https://turing.captcha.gtimg.com`、`https://turing.captcha.qcloud.com`,向 script-src 添加 `https://turing.captcha.gtimg.com`,新增 `worker-src 'self' blob:`。保留其余 CSP;未允许内联脚本、unsafe-eval 或任意脚本域名。
本地源码 `deploy/web.nginx.conf` 已同步修复;原有未上线 `/f/` 路由未混入本次发布。
## 发布隔离
- 准备期间检测到线上先更新为 `0.98.0-rc.trusted-login1`,又更新为 `0.98.1-rc.home1`。旧基线发布被保护检查中止,没有覆盖用户的新功能。
- 最终以 `0.98.1-rc.home1` Web 镜像和原 Nginx 配置为基线,仅替换 `default.conf`。HTML/静态应用资源保持不变。
- API/worker 仍为 `0.98.0-rc.trusted-login1`,容器 ID 未变、readiness 正常。没有数据库迁移、密钥修改或环境变量变更。
- 验证码策略保持 `tencent|image|2`(SaaS 腾讯云、小程序图形)。
- current 指向 `/opt/data-terminal-cloud/releases/0.98.2-rc.captcha-csp1`。
- 发布包 SHA-256:`e29a60747ffdbc866a864919b185fb0a8228dce5f0b40a048a799963fa9a20cf`。
- 服务器 manifest:当前 release 下 `captcha-csp-release-manifest.json`。
## 验证与回退
- `node --test test/tencent-captcha-csp.test.mjs`:3 项通过。指定旧配置时按预期失败,能检出资源域名和 worker 权限遗漏。
- 使用真实腾讯 SDK 的本地隔离诊断页触发 widget_ready、显示拼图,未出现 CSP 拦截;未接入业务登录/短信接口。
- 新 Web 镜像 `nginx -t` 通过;公网 `/login` 返回完整匹配的新 CSP,HTTP 200。
- 在新线上页面用合成测试输入触发弹窗,确认可见拼图;没有代做验证码,没有发送短信。
- 后续部署完整保留原 compose 各层,最后加 `deploy/server/compose.captcha-csp.yaml`。
- 如需回退,仅用 `compose.captcha-csp-rollback.yaml` 替代最后的 CSP 覆盖层,重建 Web 并重载 gateway;确认后将 current 指回 `0.98.1-rc.home1`。旧 release 和镜像已保留,不要回退数据库或 API。