5.3 KiB
5.3 KiB
审计 — 2026-06-08 服务器分类 / 分页 / 排序 / 脚本库选机
审计信息
- 日期: 2026-06-08
- 审计人: Cursor Agent
- 触发原因: 新功能(分类筛选、批量改分类、脚本库选机、分页与排序修复)生产部署
审计范围
本批次含 2026-06-07 已提交对齐项(c8b0663)与 2026-06-08 分类/分页/排序增量。
| 文件 | 状态 |
|---|---|
Dockerfile.prod |
☑ 已审(CSV 模板 COPY) |
deploy/pre_deploy_check.sh |
☑ 已审(Gate3 强制本地 BASE) |
deploy/gate_log.jsonl |
☑ 自动生成 |
server/api/servers.py |
☑ 已审 |
server/api/schemas.py |
☑ 已审 |
server/infrastructure/database/server_repo.py |
☑ 已审 |
server/infrastructure/database/migrations.py |
☑ 已审 |
server/domain/models/__init__.py |
☑ 已审 |
server/application/services/credential_poller.py |
☑ 已审 |
server/application/services/script_service.py |
☑ 已审 |
server/infrastructure/redis/script_execution_store.py |
☑ 已审(progress 成功/总数) |
server/application/services/sync_engine_v2.py |
☑ 已审 |
frontend/public/servers_import_template.csv |
☑ 已审 |
frontend/src/pages/ServersPage.vue |
☑ 已审 |
frontend/src/pages/ScriptsPage.vue |
☑ 已审 |
frontend/src/pages/CommandsPage.vue |
☑ 已审 |
frontend/src/pages/DashboardPage.vue |
☑ 已审 |
frontend/src/pages/AlertsPage.vue |
☑ 已审 |
frontend/src/pages/AuditPage.vue |
☑ 已审 |
frontend/src/pages/CredentialsPage.vue |
☑ 已审 |
frontend/src/pages/RetriesPage.vue |
☑ 已审 |
frontend/src/pages/SchedulesPage.vue |
☑ 已审 |
frontend/src/components/push/PushHistoryTable.vue |
☑ 已审 |
frontend/src/components/servers/ServerCategoryPicker.vue |
☑ 已审 |
frontend/src/composables/useServerPagination.ts |
☑ 已审 |
frontend/src/composables/useServerList.ts |
☑ 已审 |
frontend/src/composables/useServerCategories.ts |
☑ 已审 |
frontend/src/composables/push/usePushLogs.ts |
☑ 已审 |
frontend/src/composables/push/labels.ts |
☑ 已审 |
frontend/src/composables/files/constants.ts |
☑ 已审 |
frontend/src/constants/dataTable.ts |
☑ 已审 |
frontend/src/utils/paginatedFetch.ts |
☑ 已审 |
frontend/src/utils/serverTableSort.ts |
☑ 已审 |
frontend/src/utils/scriptExecutionLabels.ts |
☑ 已审 |
frontend/src/plugins/vuetify.ts |
☑ 已审 |
frontend/src/types/api.ts |
☑ 已审 |
scripts/import_servers_from_xls.py |
☑ 已审 |
tests/test_credential_poller.py |
☑ 已审 |
tests/test_rsync_push_permissions.py |
☑ 已审 |
tests/test_script_dispatch.py |
☑ 已审 |
tests/test_script_execution_progress.py |
☑ 已审 |
web/app/index.html |
☑ 构建产物入口 |
Step 3 规则扫描
| H | 规则 | 结论 |
|---|---|---|
| H1 | 批量改分类须鉴权 + 审计 | PASS Depends(get_current_admin) + audit_log batch_update_category |
| H2 | 单次批量上限防滥用 | PASS schema max_length=200;repo 分块 |
| H3 | 分类筛选 SQL 注入 | PASS 参数化 category = :cat / IS NULL |
| H4 | 前端「全部」不得单页截断 | PASS paginatedFetch 多页 200 上限循环 |
| H5 | 排序字段白名单 | PASS server_repo 仅允许已知列 |
| H6 | 导入脚本无明文密钥入仓 | PASS 读环境变量;凭据不入 git |
| H7 | CUD 无静默吞错 | PASS API 显式 HTTPException;poller 记录失败 |
Closure
| H | 判定 | 依据 |
|---|---|---|
| H1 | PASS | servers.py batch_update_category + audit |
| H2 | PASS | BatchCategoryUpdate.server_ids Field(max_length=200) |
| H3 | PASS | server_repo.list_servers 绑定参数 |
| H4 | PASS | fetchPagePerPage while 循环至 total |
| H5 | PASS | _SORT_COLUMNS 映射 |
| H6 | PASS | import_servers_from_xls.py os.environ |
| H7 | PASS | 无 bare except: pass |
Step 5 入口表
| 入口 | 鉴权 | 说明 |
|---|---|---|
GET /api/servers |
JWT | category/sort_by/sort_order 查询 |
POST /api/servers/batch/category |
JWT + admin | 批量改分类 |
POST /api/servers/batch |
JWT + admin | 名称+IP 批量添加 |
#/servers UI |
会话 | 筛选/排序/批量 |
#/scripts UI |
会话 | 分类选机 |
scripts/import_servers_from_xls.py |
CLI + JWT | 运维导入 |
Step 6 输入→Sink
category查询 → ORMWHERE category = :cat(参数化)server_ids[]→UPDATE servers SET category(IN 绑定)- Excel IP/名称 →
add-by-ipAPI(后端校验 IP 格式) - 排序列 key → 白名单映射 → ORDER BY
Step 7 归类
servers.py + schemas + server_repo 3文件 7H 0FINDING
frontend 页面/composables/utils 8文件 7H 0FINDING
import_servers_from_xls.py 1文件 2H 0FINDING
────────────────────────────────────────────────────
总计 7H 0FINDING
Step 8 DoD
- ☑ 功能与 changelog 一致
- ☑
pytest tests/test_credential_poller.py通过 - ☑ 门控 lint/import/security 通过
- ☑ 0 FINDING
FINDING 列表
无
结论
☑ 审计通过,0 FINDING,可部署