Complete CASAN backlog tier 1 controls

This commit is contained in:
thanhnv
2026-07-06 11:31:17 +09:00
parent 571c2b7e80
commit e79d7973fb
22 changed files with 685 additions and 55 deletions
@@ -6,20 +6,23 @@
## 1. Môi trường chạy
| | |
|---|---|
| Thời điểm | **2026-07-05 (UTC)** — chạy tuần tự lại toàn bộ sau H6-hardening |
| Git | `feat/plan07-track-a-hardening` (sau `2af67ef` + H6-hardening) |
| Thời điểm | **2026-07-06 (JST)** — chạy tuần tự lại sau B4 digest pinning + C4 mock IdP/OIDC + Plan-10 traceability |
| Git | working tree handoff continuation (commit pending) |
| Model | Ollama `ornith:9b` @127.0.0.1:11434 — live |
| KMS | Vault @127.0.0.1:8200 — **down lần chạy này** (KMS SKIP; đã validate **live** 2026-07-04 @ `00aabfa`) |
| Runtime | node v24.12.0 · python 3.9.0 · openssl 3.6.3 · macOS |
## 2. Bằng chứng thô (100% thật, exit code on-screen — chạy tuần tự lại lần này)
- **175 test PASS / 0 FAIL** trên **8 suite**:
- **218 test PASS / 0 FAIL** trên **13 core harness suite**:
run-casan4 **35** · adversarial **44** · phase1-track-a **25** · phase2-track-c **29** ·
phase3-evidence-pack **7** · phase-h5-approval **8** · phase-h5-infra **7** · **phase-h6-agentops 20 (mới)**.
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).
- 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).
- **H5 (run 2026-07-04, Vault live):**
- Approval-identity: env-var approver → BLOCK; reviewer **ký** request + đúng role → APPROVED; chữ ký giả / sai role / replay / tự-duyệt → BLOCK (8/8).
- Approval-identity: env-var approver → BLOCK; reviewer **ký** request + đúng role → APPROVED; mock IdP JWT hợp lệ → APPROVED; JWT hết hạn / sai role / chữ ký giả → BLOCK (12/12).
- KMS **live** (Vault Transit): sign→verify (v1) → **rotate** → sign→verify (v2) → **khoá NON-exportable** (export bị từ chối).
- WORM: ship anchor → in-sync; rollback log local → **AUDIT_GAP_DETECTED**; sửa ledger → **AUDIT_LEDGER_TAMPERED**.
- **H6 mới (chạy thật lần này — mọi check chạy LIVE qua endpoint HTTP local, cùng chuẩn "live" như Vault dev):**
@@ -35,9 +38,9 @@
|----|---------|:--:|:--:|:--:|---|---|---|
| H1 | Context | 90 | 84 | **84** | Good+ | pipeline-context pointer store, log-levels, context-validate | chưa nén/RAG context lớn (Plan-08 planned) |
| H2 | Tool | 75 | 80 | **80** | Good+ | registry, idempotency, rate-limit, action-gate, supply-chain, tool-audit | sandbox mới scaffold (chưa cô lập thật) |
| H3 | Evaluation | 85 | 82 | **82** | Strong- | LLM-judge multi-gate live, golden dataset, auto-retry, judge-gate 5/0 | judge chỉ 1 model local, chưa eval-set độc lập quy mô |
| H3 | Evaluation | 85 | 82 | **82** | Strong- | LLM-judge multi-gate live, golden dataset, auto-retry, judge-gate 5/0, Plan-10 FR→code→test matrix 3/0 | judge chỉ 1 model local, chưa eval-set độc lập quy mô/line-level traceability |
| H4 | Security | 20 | 80 | **80** | Good(đỉnh) | injection (direct/paraphrase→model/obfus/unicode/base64), indirect-artifact, secret in+out, PII, tool-output scan, strict fail-closed, recall 0.85, FP 0% | multilingual VI/JA & split-injection [planned]; sandbox scaffold; 1 model |
| H5 | Governance | 25 | 76 | **80** ⬆ | Good(đỉnh) | hash-chain + RSA head, SoD, least-privilege, rate-limit, secrets-scan, no-bypass, tool-audit, telemetry-integrity **+ approval-identity ký-danh-tính + KMS live (rotate/non-exportable) + WORM audit ngoài (gap/tamper)** | **IdP live** (registry pubkey tĩnh, chưa OIDC/JWT); **WORM store thật** (ledger local, chưa S3-Object-Lock); KMS chưa mặc định (fallback khoá local) |
| H5 | Governance | 25 | 76 | **80** ⬆ | Good(đỉnh) | hash-chain + RSA head, SoD, least-privilege, rate-limit, secrets-scan, no-bypass, tool-audit, telemetry-integrity **+ approval-identity ký-danh-tính + mock IdP/OIDC JWT + KMS live (rotate/non-exportable) + WORM audit ngoài (gap/tamper)** | **IdP live/JWKS thật**; **WORM store thật** (ledger local, chưa S3-Object-Lock); KMS chưa mặc định (fallback khoá local) |
| H6 | AgentOps | 30 | 79 | **80** ⬆ | Good(đỉnh) | cost-spike 4 chế độ (rel+abs+cumulative+cold-start), drift, hallucination-rate, telemetry token thật + ký toàn vẹn **+ alerting LIVE (webhook + dedup + dead-letter, end-to-end từ step fail) + provider-telemetry API (fetch + đối soát bắt under-reporting) + dashboard hosted (/healthz stale-aware) + window circuit-breaker (V15)** | dashboard host thật (deploy nginx/container + auth); kênh alert managed (Slack/PagerDuty + on-call, C7 incident); billing-API thật (OpenAI/Anthropic, cần key) |
| H7 | Orchestration | 80 | 80 | **80** | Good(đỉnh) | Boss DAG, BACK-TO-PLAN/retry, rollback thật, model-fallback thật, drift | chưa transaction-rollback xuyên nhiều step |
@@ -52,7 +55,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 (175 test)**. Level 5 các control hiện thực + test cục bộ; production Level 5 cần **IdP thật**, **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 (C7)**, sandbox isolation thật.
- 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.
- 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**.
@@ -66,12 +69,18 @@ bash .specify/tests/adversarial-harness-tests.sh # 44/0
bash .specify/tests/phase1-track-a-tests.sh # 25/0
bash .specify/tests/phase2-track-c-tests.sh # 29/0
bash .specify/tests/phase3-evidence-pack-tests.sh # 7/0
bash .specify/tests/phase-h5-approval-tests.sh # 8/0
bash .specify/tests/phase-h5-approval-tests.sh # 12/0
# KMS live: bật Vault dev trước để phần KMS chạy thật (không SKIP)
docker run -d -p 8200:8200 -e VAULT_DEV_ROOT_TOKEN_ID=root hashicorp/vault
VAULT_ADDR=http://127.0.0.1:8200 VAULT_TOKEN=root \
bash .specify/tests/phase-h5-infra-tests.sh # 7/0 (KMS live + WORM)
bash .specify/tests/phase-h6-agentops-tests.sh # 20/0 (alerting live + provider-API + hosted dashboard + V15)
bash .specify/tests/phase-c7-incident-tests.sh # 15/0
bash .specify/tests/phase-h4-multilingual-tests.sh # 7/0
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/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.