# CASAN — Đánh giá điểm CÔNG TÂM (chạy thật + chấm theo rubric) > Chạy thật tại thời điểm nộp; chấm theo `casan_harness_assessment.md` một cách **công tâm**, không lấy (5/5 gate)×100. > Tư tưởng CASAN: *điểm = thứ chứng minh được bằng tấn công* **và** *"81–100 = đủ tiêu chuẩn vận hành thật"* — mà `CASAN_HARDENING_STATUS.md` §4 tự nhận trio H4/H5/H6 mới ở **~3.8–4.0/5**, nhiều hạng mục production còn **[planned]**. Vì vậy điểm công tâm nằm ở dải **"Good" (61–80)**, chưa phải 100. ## 1. Môi trường chạy | | | |---|---| | 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) - **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 **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: **11 PASS / 0 FAIL** (includes model-digest pin OK, mismatch BLOCK, mismatch WARN rollout mode, deterministic OpenAI/Anthropic usage parser coverage). - 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). - **H5 (run 2026-07-04, Vault live):** - 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):** - Alerting live: alert POST tới webhook thật → **ALERT_DISPATCHED**; trùng trong dedup-window → **SUPPRESSED** (không page đôi); webhook chết + strict → **ALERT_DELIVERY_FAILED** + vào **dead-letter**; kênh sống lại → flush **redelivered=1 remaining=0**; end-to-end: step fail trong `agent-metrics` → webhook nhận alert live. - Provider-telemetry API: fetch usage từ API HTTP live → import kèm provenance; schema sai → **REJECT all-or-nothing**; API chết → **fail-loud**; đối soát local-vs-provider: khớp → **TELEMETRY_RECONCILED**, local khai thiếu token (giấu chi phí) → **TELEMETRY_DISCREPANCY**. - Dashboard hosted: serve qua HTTP, `/healthz` **200 ok** khi telemetry tươi, **503 stale** khi metrics chết lặng (uptime-monitor page được). - V15: xen kẽ success/fail né được counter liên tiếp nhưng **CIRCUIT_OPEN_WINDOW** (rate ≥50%/10 call) vẫn trip; log khoẻ → không false-trip. - `scorecard.sh` (công cụ **coverage**): mọi control H4/H5/H6 đều ✓ (5/5). *Đây là "mọi control đều chạy & chặn được", KHÔNG phải điểm trưởng thành.* ## 3. ĐIỂM CÔNG TÂM theo rubric (thang: 0–30 GAP · 31–60 Partial · 61–80 Good · 81–100 Strong=production) | ID | Harness | Demo baseline (2026-06-26) | Trước H5-hardening | **Công tâm (nay)** | Band | Chứng minh (đã test) | Gap production còn mở | |----|---------|:--:|:--:|:--:|---|---|---| | 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, 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 + 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 | **Average: 57.9 → 80.1 → ~80.9 / 100 · Harness thấp nhất giờ = 80 (đồng đều H2/H4/H5/H6/H7 — không còn harness tụt lại) · CASAN Level 4 (vững ngưỡng).** > H5 tăng 76 → **80**: ba đường lọt lớn nhất (duyệt tin env-var · khoá ký local · audit xoá được) đã có **MVP hiện thực + test thật** (approval ký-danh-tính, KMS live rotate/non-exportable, WORM ledger). Vẫn **giữ ở đỉnh "Good" (80)** — chưa lên "Strong/production" — vì bản production của cả ba (IdP live, WORM store thật, KMS mặc định) còn [planned]. > > H6 tăng 79 → **80** (cùng logic): ba gap của chính report này (dashboard tĩnh · chưa alerting live · chưa provider-telemetry API) + V15 đã có **MVP hiện thực + 20 test thật chạy LIVE** (webhook/dead-letter, API fetch + reconcile, /healthz stale-aware, window breaker). **Giữ ở đỉnh "Good" (80)** — chưa Strong — vì bản production (dashboard deploy thật + auth, kênh alert managed + on-call/C7, billing-API thật) còn [partial/planned]. Kết quả: **không còn harness nào dưới 80** → trần pipeline do nhóm 80 quyết định, vẫn là Level 4 chứng minh được (chưa phải Level 5 production). ## 4. Vì sao KHÔNG chấm 100 / chưa lên Strong (công tâm) - Rubric: **81–100 = "đủ tiêu chuẩn vận hành thật"**. `CASAN_HARDENING_STATUS.md` §3 còn nhiều hạng mục production **[planned/partial]** (multilingual, sandbox isolation, IdP/WORM-store thật, dashboard deploy thật + kênh alert managed + billing-API thật) → trần công tâm của trio là **80 (đỉnh "Good")**. - (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 + 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**. - Chi tiết implemented-vs-planned: `casan-next-plans/CASAN_HARDENING_STATUS.md`. ## 6. Tự tái lập ```bash cd AINative_OKR_CASAN5 bash .specify/tests/run-casan4-harness-tests.sh # 35/0 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 # 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 # 11/0 (direct model-router/digest/cloud parser 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. > > Ghi chú fix trong lần chạy 2026-07-05: `sign-policy-bundle.sh` (fallback local) trước đây chỉ export `policy-public.pem` khi TẠO key mới → sau lần ký qua Vault (07-04), chạy lại lúc Vault down sẽ verify sai key (RSA padding error, run-casan4 chết giữa suite). Đã vá theo đúng invariant key-sync (luôn re-export pubkey trước khi ký) — cùng class lỗi đã vá ở `tool-audit-lib.sh`/`governance-check.sh`.