سامانه صدور فاکتور و حسابداری
Document verified Office Slice C5 evidence
davoodmehraban89 committed
Oct 1, 2026 at 00:12 UTC
6d488d1b88439e47759fe1fca97918e0847a20b9
1 file changed
+56
docs/OFFICE_SLICE_C5_VERIFICATION.md
new
+56
@@ -0,0 +1,56 @@
1
+# Office Slice C5 — Internal Approval / Attestation Verification
2
+
3
+Date: 2026-10-01
4
+Project: `hcsixhqbyuhpshfwqpjx`
5
+
6
+## Delivered
7
+- Server-authoritative internal approval requests for registered correspondence.
8
+- Assigned approver must be an active organization member with both Office `approve` and `read` access to the exact source letter.
9
+- Requester cannot self-approve; only the bound approver can decide.
10
+- Approval evidence is append-only in the protected Office audit channel.
11
+- One active request per correspondence; terminal decisions are exactly `approved` or `rejected`.
12
+- Rejection permits a later fresh approval request while preserving prior evidence.
13
+- Request and decision record authenticated user, timestamp, note and JWT AAL metadata.
14
+- Each request stores a SHA-256 `contentDigest` of the correspondence JSON. A decision is rejected if the letter changed after the request; the queue exposes `content_changed`.
15
+- UI exposes «تأییدات داخلی», request, queue, approve/reject and stale-content indication.
16
+- This is internal authenticated attestation only and is **not a qualified digital signature**.
17
+
18
+## Production migrations
19
+- `20260930203456 office_slice_c5_internal_approval` — initial C5 foundation.
20
+- `20260930203620 office_slice_c5_internal_approval` — content-bound attestation hardening and queue expansion.
21
+- `20260930203709 office_c5_decision_event_order_fix` — corrected decision request ordering to use immutable event time stored in JSON rather than a nonexistent records column.
22
+
23
+All three production SQL steps are archived under `supabase/migrations/`.
24
+
25
+## Adversarial production verification
26
+Transactional verification used existing legitimate principals and rolled back all temporary state.
27
+
28
+PASS:
29
+1. Member without approval/read authorization cannot be assigned.
30
+2. Requester cannot assign self as approver.
31
+3. Authorized target can receive an approval request.
32
+4. Request evidence contains a 64-character SHA-256 content digest, AAL evidence and an explicit `qualifiedDigitalSignature=false` boundary.
33
+5. Duplicate active request is rejected.
34
+6. Requester cannot decide the request.
35
+7. Queue reports pending/overdue state.
36
+8. Mutating letter content after request makes `content_changed=true`.
37
+9. Changed content cannot be approved; server requires a fresh request.
38
+10. After restoring the exact requested content, assigned approver can reject.
39
+11. A new request after rejection can be approved.
40
+12. Duplicate terminal decision is rejected.
41
+13. Cross-tenant principal receives no approval queue rows.
42
+14. Rollback residue is zero; temporary member is absent and temporary seat expansion returned to `max_users=1`.
43
+
44
+## CI evidence
45
+Verified C5 runtime/hardening head: `02f76f18c7685a4da88de68972113d32b30a21fb`.
46
+- Quality `36774255459`: PASS including JavaScript syntax, all accounting/Golden/ELI/C1-C5 invariants and Real-DOM.
47
+- Security `36774255463`: CodeQL JavaScript PASS. Dependency Review remains skipped because repository Dependency Graph is not enabled.
48
+- Pages `36774253349`: build/deploy/report PASS.
49
+
50
+## Advisor status
51
+- C5 uses public SECURITY INVOKER wrappers over private authorization-checked implementation functions, so the current external SECURITY DEFINER warning count did not increase because of C5.
52
+- Existing advisor warnings remain: 20 authenticated-callable SECURITY DEFINER functions elsewhere and leaked-password protection disabled.
53
+- Performance advisor reports 12 unused-index informational notices.
54
+
55
+## Scope boundary
56
+C5 does not claim qualified digital signature, external certificate/timestamp authority, persistent two-real-user browser E2E, OCR/full-text quality or external delivery adapters.