feat: add versioned multi-component assessment registry

This commit is contained in:
Luftmensch
2026-09-04 10:33:36 +07:00
parent 4f4c7df4ed
commit 9f34cf8afd
9 changed files with 906 additions and 38 deletions
+12 -4
View File
@@ -1,7 +1,7 @@
# PROJECT STATUS — Audit Hardening Tool
> Cập nhật lần cuối: 2026-09-04 09:12 (bởi: Hermes)
> Evaluator hiện tại: grok-build (grok-4.6)
> Cập nhật lần cuối: 2026-09-04 (bởi: Hermes + Codex gpt-5.6-sol)
> Evaluator hiện tại: Hermes verification; Kimi kiến trúc đã hoàn thành, Grok CLI chưa đăng nhập
## Phase hiện tại
- [x] Phase 1 — Plan (`.hermes/plans/2026-09-04_091241-upload-checklist-config.md`)
@@ -11,21 +11,27 @@
- [x] Phase 5 — Tracking
## Tổng quan
Bổ sung upload/thay thế checklist XLSX và rule JSON trên trang quản lý công cụ. Chức năng giới hạn admin, sử dụng mapping OS cố định và backup file cũ.
Đã chuyển checklist/rule sang registry dữ liệu phân cấp Category → Component → Profile → ProfileVersion, có checksum, artifact bất biến, active version và rollback; vẫn tương thích `os_type` cũ.
## Việc đã xong
- [2026-09-04] Khảo sát `OS_CONFIG`, trang `admin_tools`, quyền admin/analyzer và bind mount `config`.
- [2026-09-04] Chốt thiết kế upload an toàn, không nhận path/tên đích từ client.
- [2026-09-04] Hoàn thành endpoint admin, UI upload checklist/rule, backup atomic và Docker RW mount; 8 regression tests pass.
- [2026-09-04] Thêm `RegistryService`, manifest schema v2 và atomic manifest/artifact writes; seed 5 OS cùng legacy aliases vào `config/registry`.
- [2026-09-04] Thêm read API `/api/v2/registry`, `/api/v2/profiles/active` và admin API/UI tạo category/component/profile, upload/activate/rollback version.
- [2026-09-04] Upload Web/async/API giữ `os_type` bắt buộc để tương thích và nhận thêm `profile_id` tùy chọn; audit UI cho phép override active profile mà không đổi auto OS mặc định.
- [2026-09-04] Xác nhận quyền: checklist/profile mutation chỉ admin; analyzer chỉ quản lý tool; `dev_guest` chỉ có luồng audit upload.
## Việc đang làm / Bước tiếp theo
- Commit/push lên Gitea, deploy NAS và kiểm thử upload thực tế qua Web.
- Push lên Gitea, deploy NAS và kiểm thử Web với một profile OS cũ cùng một profile component mới.
## Quyết định đã chốt
- Chỉ admin được upload checklist/rule config; analyzer chỉ upload tool.
- Checklist chỉ nhận `.xlsx`, rule config chỉ nhận JSON hợp lệ.
- Tên file đích lấy từ `OS_CONFIG`; không cho path traversal.
- Backup file hiện tại trước khi thay thế.
- Registry nằm dưới persistent mount riêng `/app/registry`; legacy files được giữ nguyên và compatibility upload tạo version mới thay vì ghi đè artifact active.
- `profile_id` override `os_type`; nếu bỏ trống, alias `os_type` resolve tới active profile version.
## Đánh giá các phase
| Phase | Ngày | Evaluator | Kết quả | Ghi chú |
@@ -34,6 +40,7 @@ Bổ sung upload/thay thế checklist XLSX và rule JSON trên trang quản lý
| Direction | 2026-09-04 | grok-build | BLOCKED | Grok CLI chưa đăng nhập |
| Knowledge | 2026-09-04 | Hermes | PASS | Dựa trên code/mount thực tế |
| Execution | 2026-09-04 | Hermes | PASS | 8 tests, compile, Jinja, Compose, diff check đều pass; Grok review bị chặn auth |
| Registry architecture | 2026-09-04 | Codex + Hermes | PASS | 23 tests gọi trực tiếp pass; py_compile, Jinja parse, Compose config và diff check pass. |
## Kiến thức thu thập
- `OS_CONFIG` định nghĩa đúng cặp checklist/config cho Windows, CentOS, RHEL, Ubuntu, Oracle Linux.
@@ -42,6 +49,7 @@ Bổ sung upload/thay thế checklist XLSX và rule JSON trên trang quản lý
## Rủi ro / Vướng mắc
- File checklist/rule sai nội dung có thể làm xử lý audit lỗi; giảm thiểu bằng validation JSON, extension, backup và atomic replace.
- `pytest` package chưa có trong runtime local; test suite đã chạy bằng deterministic lightweight runner, gồm fixture `tmp_path`, tổng cộng 23 tests pass.
## Lệnh thường dùng
- `python -m py_compile app/web_app_fastapi.py`