fix: harden platform audit coverage

This commit is contained in:
2026-07-27 11:13:55 +08:00
parent 48fc80b003
commit 0ba4136e1a
7 changed files with 125 additions and 13 deletions

View File

@@ -12,6 +12,7 @@
| 前端资源与后端路由只按资源名和文件名进行粗略匹配 | `ResourceContract.Path` 成为唯一后端路径声明;审计逐项校验 GET/POST/PUT/PATCH/DELETE按资源模式以及资源路径一致性 | Go 的 `TestEveryContractHasRegisteredRoute``pnpm audit:platform` |
| 页面存在但未被菜单路由实际加载时可能漏检 | 审计读取全部路由模块,解析页面动态导入,再确认页面通过 `getResource(契约路径)` 使用对应资源且路由具有 `menu.platform.*` 元数据 | `audit-check.test.mjs` 的菜单映射用例 |
| API 或页面可能展示、提交数据库自增 `id` / `*_id` | 对 `src/api``src/views` 全量扫描;详情页的显式过滤逻辑被识别为防护而非泄漏 | `pnpm audit:platform` |
| 仅追加处置和只读状态写入存在审计盲区 | 处置资源必须由 `saf_event` 详情动作触发、不可拥有独立页面;后端仅允许 GET/POST且按事件标识查询处置历史只读资源扫描 API、路由和页面中的 `updateStatus` | 6 个 `audit-check.test.mjs` 用例及逐契约路由方法测试 |
## 身份字段与保留理由
@@ -47,7 +48,7 @@ pnpm build
| `go test ./...` | 0 | 通过 |
| `go build ./cmd/main` | 0 | 通过 |
| `go test ./internal/routers -run '^TestEveryContractHasRegisteredRoute$' -v` | 0 | 通过 |
| `node --test scripts/audit-check.test.mjs` | 0 | 通过,3 个审计用例 |
| `node --test scripts/audit-check.test.mjs` | 0 | 通过,6 个审计用例 |
| `pnpm type:check` | 0 | 通过 |
| `pnpm audit:platform` | 0 | 通过 |
| `pnpm build` | 0 | 通过 |