fix: close platform admin final audit findings
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
# Platform Admin Final Important Fixes Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 修复平台总后台终审的 8 项 Important 问题,并以回归测试、全量校验和提交记录证明修复结果。
|
||||
|
||||
**Architecture:** 后端统一在资源边界完成响应投影、关键字查询和精确位置授权,避免各页面或处理器自行绕过安全规则。前端以类型化字段定义驱动表单控件和请求载荷,并为审批与树归档提供明确交互;模型注释通过 AST 审计守住完整性。
|
||||
|
||||
**Tech Stack:** Go 1.26、Gin、GORM、Vue 3、TypeScript、Arco Design Vue、Node test runner、Biome 2.5、pnpm。
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- HTTP 仅公开 `identity` 和 `<实体>_identity`,禁止公开数据库自增 ID。
|
||||
- 精确轨迹坐标必须由显式短期授权声明控制,普通列表和详情必须脱敏。
|
||||
- 可选关系为空时不进入请求体;数字、布尔、时间和 JSON 字段保持正确类型。
|
||||
- 归档为 `status=archived`,不得物理删除。
|
||||
- 所有模型字段必须有中文注释。
|
||||
|
||||
---
|
||||
|
||||
### Task 1: 后端安全边界与筛选
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend/api/internal/logic/platform/task4_resources.go`
|
||||
- Modify: `backend/api/internal/logic/platform/platform.go`
|
||||
- Modify: `backend/api/internal/logic/platform/resource.go`
|
||||
- Modify: `backend/api/internal/routers/platform.go`
|
||||
- Test: `backend/api/internal/logic/platform/resource_test.go`
|
||||
- Test: `backend/api/internal/routers/platform_test.go`
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: Gin 查询参数、JWT `location_scope`、资源关系定义。
|
||||
- Produces: 创建响应公共投影、轨迹点脱敏处理器、通用 `keyword` 过滤。
|
||||
|
||||
- [ ] **Step 1: 写创建响应、轨迹点授权和关键字筛选失败测试。**
|
||||
- [ ] **Step 2: 运行定向 Go 测试并确认按预期失败。**
|
||||
- [ ] **Step 3: 统一创建响应投影,轨迹点改为只读授权处理器,并把安全关键字条件同时用于 count/list。**
|
||||
- [ ] **Step 4: 运行定向 Go 测试并确认通过。**
|
||||
|
||||
### Task 2: 前端类型化表单、审批和树归档
|
||||
|
||||
**Files:**
|
||||
- Modify: `frontend/platform_admin/src/api/resources.ts`
|
||||
- Create: `frontend/platform_admin/src/api/resource-form.ts`
|
||||
- Modify: `frontend/platform_admin/src/views/shared/CrudListPage.vue`
|
||||
- Modify: `frontend/platform_admin/src/views/shared/ReadOnlyListPage.vue`
|
||||
- Modify: `frontend/platform_admin/src/views/shared/TreePage.vue`
|
||||
- Test: `frontend/platform_admin/scripts/final-important.test.mjs`
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: `ResourceField{type, required}` 与当前表单值。
|
||||
- Produces: `buildResourcePayload(fields, form)`,以及审批 POST 和树归档交互。
|
||||
|
||||
- [ ] **Step 1: 写字段类型、空可选关系、审批动作和树归档失败测试。**
|
||||
- [ ] **Step 2: 运行 Node 测试并确认按预期失败。**
|
||||
- [ ] **Step 3: 实现类型化控件/载荷、审批详情动作和树归档确认。**
|
||||
- [ ] **Step 4: 运行 Node 测试并确认通过。**
|
||||
|
||||
### Task 3: Biome 与模型中文注释
|
||||
|
||||
**Files:**
|
||||
- Modify: `frontend/platform_admin/biome.json`
|
||||
- Modify: `backend/api/internal/models/*.go`
|
||||
- Test: `backend/api/internal/models/comments_test.go`
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: Biome 配置与 Go AST。
|
||||
- Produces: 不依赖缺失本地 ignore 文件的 lint 配置,以及每个导出模型字段的中文注释。
|
||||
|
||||
- [ ] **Step 1: 复现 Biome ignore-file 配置错误并写模型注释 AST 失败测试。**
|
||||
- [ ] **Step 2: 修正 Biome VCS ignore 配置,为全部模型字段补中文注释。**
|
||||
- [ ] **Step 3: 运行 `go test ./...`、Node 测试、`pnpm audit:platform`、`pnpm lint`、`pnpm type:check` 和 `pnpm build`。**
|
||||
- [ ] **Step 4: 复核差异并提交。**
|
||||
Reference in New Issue
Block a user