docs: update project documentation with P0/P1/P2 fix status

- Add security features section to README
- Add security architecture section 12.1 and 12.2 to ARCHITECTURE
- Add validation commands section to DEPLOYMENT
- Update PRD with fix completion status
This commit is contained in:
2026-04-18 21:30:14 +08:00
parent 509c5ca2fd
commit 85285c16d1
4 changed files with 130 additions and 18 deletions

View File

@@ -1154,11 +1154,39 @@ groups:
6. **扩展性**: 水平扩展、垂直扩展
7. **高可用**: 多机房部署、数据备份
通过以上优化,系统能够达到 PRD 要求的性能指标:
- 10 亿用户规模
- 10 万级并发
- P99 响应时间 < 500ms
- 99.99% 可用性
### 12.1 安全架构
| 安全机制 | 实现状态 | 说明 |
|----------|----------|------|
| 密码哈希 | ✅ Argon2id | 64MB 内存5次迭代4并行 |
| JWT JTI 防枚举 | ✅ | timestamp(8B hex) + random(16B hex) |
| Token 滚动轮换 | ✅ | refresh token 每次刷新后旧值失效 |
| 访问令牌内存存储 | ✅ | 前端不使用 localStorage 存 token |
| 401 并发刷新锁 | ✅ | 单例 Promise 模式 |
| CSRF 保护 | ✅ | POST/PUT/DELETE/PATCH 自动注入 CSRF Token |
| 常数时间密码比较 | ✅ | 防时序攻击 |
| JWT Secret 弱检测 | ✅ | 启动时 Warn 日志 |
| TOTP 设备信任 | ✅ | 信任设备免二次验证 |
| 密码修改 PCE | ✅ | PasswordChangedAt 更新使旧 token 失效 |
### 12.2 已修复的安全问题
| 问题 | 严重等级 | 修复版本 |
|------|----------|----------|
| LIKE 查询 SQL 注入 | P0 | 2026-04-09 |
| 登录计数竞态条件 | P0 | 2026-04-09 |
| Refresh Token 黑名单 fail-open | P0 | 2026-04-09 |
| 验证码 Replay 攻击 | P0 | 2026-04-09 |
| CORS 危险配置 | P0 | 2026-04-09 |
| UpdateUser IDOR 越权 | P0 | 2026-04-09 |
| Login TOTP 绕过 | P0 | 2026-04-09 |
| 游标分页数据错乱 | P0 | 2026-04-09 |
| 错误信息泄露 | P1 | 2026-04-09 |
| OAuth context 丢失 | P1 | 2026-04-09 |
| rows.Err 未检查 | P1 | 2026-04-09 |
| DeleteRole 非事务 | P1 | 2026-04-09 |
| ActivateEmail GET 越权 | P2 | 2026-04-18 |
| ValidateResetToken GET 越权 | P2 | 2026-04-18 |
---

View File

@@ -818,6 +818,31 @@ setup.template.pattern: "user-ms-*"
| API 响应时间 | curl -w @curl-format.txt | < 500ms | 优化代码 |
| 错误日志 | tail -f error.log | 无新错误 | 排查问题 |
### 3.2 验证命令
```bash
# Go 构建检查
go build ./cmd/server
# Go 代码检查
go vet ./...
# Go 单元测试(跳过大规模性能测试)
go test ./internal/... -skip TestScale -count=1
# 前端 lint 检查
cd frontend/admin && npm run lint
# 前端测试
cd frontend/admin && npm test
# 前端构建
cd frontend/admin && npm run build
# 安全依赖检查
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
```
---
### 3.2 备份与恢复

View File

@@ -7,8 +7,8 @@
| 产品名称 | 用户管理系统 (User Management System) |
| 文档版本 | v1.0 |
| 创建日期 | 2026-03-10 |
| 最后更新 | 2026-03-11 |
| 文档状态 | 草稿 |
| 最后更新 | 2026-04-18 |
| 文档状态 | 已完成 |
---
@@ -629,6 +629,37 @@
## 后续迭代功能
### 已完成的安全和质量修复2026-04-18
所有 P0、P1、P2 问题已在 `fix/status-review-sync-20260409` 分支上全部修复并验证通过。
| 问题ID | 描述 | 严重等级 | 状态 |
|--------|------|----------|------|
| P0-01 | LIKE 查询 SQL 注入风险 | P0 | ✅ 已修复 |
| P0-02 | 登录失败计数器竞态条件 | P0 | ✅ 已修复 |
| P0-03 | Token 刷新黑名单写入失败 | P0 | ✅ 已修复 |
| P0-04 | 密码重置验证码 Replay 攻击 | P0 | ✅ 已修复 |
| P0-05 | CORS 默认配置危险 | P0 | ✅ 已修复 |
| P0-06 | UpdateUser IDOR 越权 | P0 | ✅ 已修复 |
| P0-07 | Login 绕过 TOTP | P0 | ✅ 已修复 |
| P0-08 | 游标分页数据错乱 | P0 | ✅ 已修复 |
| P1-01 | 错误处理中间件泄露信息 | P1 | ✅ 已修复 |
| P1-02 | OAuth context 丢失 | P1 | ✅ 已修复 |
| P1-03 | 导出功能泄露信息 | P1 | ✅ 已修复 |
| P1-04 | CountByResultSince 错误忽略 | P1 | ✅ 已修复 |
| P1-05 | DeleteRole 非事务性 | P1 | ✅ 已修复 |
| P1-06 | ChangePassword 无 Token 失效 | P1 | ✅ 已修复 |
| P1-07 | SetDefault 非原子性 | P1 | ✅ 已修复 |
| P1-08 | 连接池参数硬编码 | P1 | ✅ 已修复 |
| P1-09 | rows.Err() 未检查 | P1 | ✅ 已修复 |
| P2-10 | ActivateEmail 使用 GET | P2 | ✅ 已修复 |
| P2-11 | ValidateResetToken 使用 GET | P2 | ✅ 已修复 |
| P2-13 | cursor.Encode 忽略错误 | P2 | ✅ 已修复 |
| P2-14 | initDefaultData 无错误聚合 | P2 | ✅ 已修复 |
| P2-15 | JWT NewJWT 返回损坏对象 | P2 | ✅ 已修复 |
详细验证报告:`docs/status/REAL_PROJECT_STATUS.md`
### 规则引擎(权限管理增强)
#### 功能描述