Files
Mdeical_Sur_Report/docs/security.md
admin 911b96b883 Add demo mode factory reset
- Align the backend seeded default surgery template with the report editor's default report content.

- Add backend demo defaults for the default template, Kimi provider, and Xunfei speech proxy configuration.

- Change system reset into a super-admin demo mode factory reset that clears reports, audit logs, files, custom templates, and non-default users.

- Keep only the default admin, manager, doctor, and default surgery template after demo reset.

- Replace the old local-only reset all data button with a two-confirmation backend reset flow.

- Add tests covering demo default alignment and database-backed demo reset behavior.

- Update docs to describe demo mode reset semantics and production credential cautions.
2026-05-02 02:52:30 +08:00

25 lines
2.4 KiB
Markdown
Raw 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.
# 安全说明
## 当前安全边界
本项目当前处于后端化迁移期。登录认证、数据库 Session、工作台统计、报告、报告媒体关系、模板、字段库、模板图片资源、视频/关键帧文件、用户、部门模板授权、系统设置、签名文件、AI 对话和讯飞语音听写已接入后端 Session/API/代理,后端账号密码使用 Argon2 哈希。客户端权限只能防止普通误操作,不能抵御有意绕过。
## 主要风险
- 开发模式 `localStorage.users` 仍保留兼容缓存和旧演示密码字段;生产构建默认关闭本地回退。
- AI Key 和讯飞语音密钥已由后端代理使用;普通用户读取系统设置时不会返回真实密钥。超级管理员仍可维护全局密钥,应避免把密钥写入源码、日志或文档。
- 当前 demo mode 后端默认值包含演示用第三方服务凭据;旧版本源码中也存在默认服务密钥痕迹,应视为已暴露。生产化前必须移除或替换演示凭据,并轮换曾经暴露过的第三方密钥。
- 报告和模板 HTML 保存时已做服务端白名单清洗,但仍直接渲染 HTML需要继续做绕过测试和打印兼容测试。
- 浏览器存储没有审计、备份、权限隔离和加密能力。
- 医疗病历数据属于敏感数据,不能直接用于公网生产。
## 生产化建议
1. 完善服务端权限校验:报告、模板、用户、设置和文件 API 必须全部按角色、部门和作者强校验。
2. 增加服务端数据层:视频和关键帧文件已完成第一版 Files API报告媒体引用已拆到 `ReportMedia`;字段库和模板图片资源已完成第一版 API。
3. 增加文件服务:报告图片、视频和关键帧后续可切换对象存储或院内文件服务;签名、模板图片、视频和关键帧已完成第一版后端文件资源。
4. 完善 API 代理AI 和语音已完成第一版后端代理,后续应补限流、审计、错误分级和第三方调用隔离测试。
5. 增强 HTML 清洗:当前报告和模板保存已有第一版白名单过滤,后续需覆盖 AI 返回、导入文件、旧数据迁移和绕过测试。
6. 增强审计日志:当前登录、报告/模板/用户/设置/文件修改已有审计写入和查询页面;后续补打印/导出错误追踪和第三方代理调用摘要。报告导出不要求专门导出审计。
7. 增加数据备份与恢复:避免浏览器清理缓存造成业务数据丢失。