Add local production infra lab

This commit is contained in:
thanhnv
2026-07-06 12:00:27 +09:00
parent ec261bcbc5
commit fc736aabf1
16 changed files with 623 additions and 23 deletions
@@ -18,6 +18,7 @@
phase3-evidence-pack **7** · phase-h5-approval **12** · phase-h5-infra **7** · phase-h6-agentops **20** ·
phase-c7-incident **15** · phase-h4-multilingual **7** · phase-c6-sandbox **6** · phase-h4-split-inject **8** · phase10-traceability **3**.
- Direct model-router suite: **10 PASS / 0 FAIL** (includes model-digest pin OK, mismatch BLOCK, mismatch WARN rollout mode).
- Local production-like Docker infra lab: **2 PASS / 0 FAIL**, with `infra-lab verify` internal **7 PASS / 0 FAIL** (Vault Transit, OIDC/JWKS, MinIO Object Lock, alert webhook, billing API mock, dashboard nginx auth).
- Frontend Vitest: **16 PASS / 0 FAIL**. Backend `npm test` is blocked by pre-existing app-test infra mismatch (`schema.prisma` provider MySQL but `setup-sqlite.mjs` applies the MySQL migration to SQLite).
- `security-gate` aggregate: **verdict PASS=11 FAIL=0 SKIP=0** (run 2026-07-04).
- H4 recall: model 0.85 > regex 0.00 (GATE PASS). Benign-FP: **fp_rate 0.00% · block_rate 100.00%** (95 mẫu benign EN/VI/JA + 12 vector).
@@ -55,7 +56,7 @@
- (5/5 gate)×100 chỉ đo **độ phủ control**, không đo **độ trưởng thành/vận-hành-thật** — report này tách bạch: mục 2 = coverage/pass thật, mục 3 = trưởng thành công tâm.
## 5. Ranh giới trung thực
- CASAN **Level 4 chứng minh bằng tấn công (218 core harness tests)**. Level 5 các control hiện thực + test cục bộ; production Level 5 cần **IdP thật/JWKS**, **WORM store (S3 Object Lock)**, KMS mặc định + HSM, **billing-API thật** (usage endpoint OpenAI/Anthropic), **dashboard deploy thật** (nginx/container + auth), **kênh alert managed + on-call**, sandbox isolation rootless/nsjail/base image CI.
- CASAN **Level 4 chứng minh bằng tấn công (218 core harness tests + local-prod Docker infra lab)**. Level 5 các control hiện thực + test cục bộ; production Level 5 vẫn cần **enterprise IdP/JWKS**, **WORM store thật (S3 Object Lock/QLDB)**, KMS mặc định + HSM, **billing-API thật** (usage endpoint OpenAI/Anthropic), **dashboard deploy managed + TLS/OIDC**, **kênh alert managed + on-call**, sandbox isolation rootless/nsjail/base image CI.
- KMS đã chạy **live qua Vault dev** ở lần chấm 2026-07-04 (đường Transit thật, khoá non-exportable); lần chạy 2026-07-05 Vault down → suite KMS **SKIP đúng thiết kế** (không tính là fail). Production thay bằng Vault/AWS-KMS/CloudHSM.
- H6 "live" nghĩa là: webhook, provider-usage API, dashboard `/healthz` đều là **endpoint HTTP thật chạy local** (cùng chuẩn Vault-dev) — chưa phải dịch vụ hosted/managed bên ngoài.
- Model = Ollama ornith:9b **local**; đường cloud (OpenAI/Anthropic) đã hiện thực trong `model-call.py` nhưng **chưa test bằng key thật**.
@@ -81,6 +82,7 @@ bash .specify/tests/phase-c6-sandbox-tests.sh # 6/0
bash .specify/tests/phase-h4-split-inject-tests.sh # 8/0
bash .specify/tests/phase10-traceability-tests.sh # 3/0
bash .specify/tests/phase3-model-router-tests.sh # 10/0 (direct model-router/digest suite)
bash .specify/tests/phase-prod-infra-lab-tests.sh # 2/0, starts Docker infra lab
bash .specify/scripts/bash/security-gate.sh # verdict PASS=11 FAIL=0
```
> Mục 3 là **đánh giá trưởng thành theo rubric** (người chấm, neo vào bằng chứng + gap thật), không phải output tự động của scorecard.sh (vốn chỉ đo coverage). Suite model cần Ollama live; suite KMS cần Vault live để chạy (không có thì SKIP, không tính là fail). Suite H6 **tự dựng** webhook sink / mock provider-API / dashboard server trên cổng ephemeral local — deterministic, không cần model.