@davoodmehraban89 / Aram-2 Mirror · read-only / commits / 9368fd2
Fork 0

Mirrored from https://github.com/davoodmehraban89/Aram.git

Synced Dec 3, 20:45 UTC

feat(gate3): protect mapping API and add externally verifiable audit chain

Davood Mehraban committed Nov 1, 2026 at 22:18 UTC 9368fd24798af52fe65acdffb46f43dd390303ed
9 files changed +408 -2
PROJECT_STATUS.md
+8
@@ -106,3 +106,11 @@ The accepted branch does not include PR #7 desktop/release work, PR #16 alternat
106 - Review evidence: docs/GATE3_PACKAGE4_REVIEW.md (three self-review perspectives, not independent reviewers).
107 - Formal Gate 3 status: CHANGES REQUESTED; PR must remain Draft. Do not merge/release/start Gate 4 implementation before independent acceptance.
108 - Remaining blockers: independent reviewer approval, API/IdP authorization integration, external audit integrity, authorized financial reconciliation and operational recovery evidence.
109 +
110 +## 2026-11-01 — Gate 3 Package 5 (current status)
111 +- Branch feat/gate3-governed-mapping-20261101; PR #82 remains Draft; base source-data-cleanup@7dc864fd032f0c4ae4d650d89304a01286a6d914 unchanged.
112 +- Protected mapping HTTP endpoints added; server-only resolver required and absent by default (fail closed). No real production IdP integration is claimed.
113 +- SHA-256 per-event audit chain and externally verifiable receipt support added. No separately protected receipt anchor configured; privileged tampering remains possible.
114 +- Synthetic HTTP, audit tamper, backup/restore and financial mapping tests added; no authorized real financial data or production DR drill performed.
115 +- Three perspective-based self-audits, NOT three independent reviewers. See docs/GATE3_PACKAGE5_ACCEPTANCE.md.
116 +- Decision: NO-GO / CHANGES REQUESTED. Do not merge, release or begin Gate 4 until policy prerequisites satisfied.
backend/src/aram_backend/main.py
+8 -1
@@ -2,11 +2,18 @@ from fastapi import FastAPI
2
3 from aram_backend import __version__
4 from aram_backend.config import get_settings
5 +from aram_backend.mapping_api import router as mapping_router
6 from aram_backend.models import FiscalYearStatus, StatementType
6 -from aram_backend.schemas import EntityDescriptor, EnumCatalog, HealthResponse, SchemaCatalog
7 +from aram_backend.schemas import (
8 + EntityDescriptor,
9 + EnumCatalog,
10 + HealthResponse,
11 + SchemaCatalog,
12 +)
13
14 settings = get_settings()
15 app = FastAPI(title=settings.app_name, version=__version__)
16 +app.include_router(mapping_router)
17
18
19 @app.get("/api/v1/health", response_model=HealthResponse, tags=["system"])
backend/src/aram_backend/mapping_api.py new
+114
@@ -0,0 +1,114 @@
1 +"""Protected mapping HTTP operations.
2 +
3 +A deployment MUST supply a trusted identity resolver and an isolated MappingStore.
4 +The API never accepts actor, roles, or company permissions from request bodies.
5 +"""
6 +from __future__ import annotations
7 +
8 +from collections.abc import Callable
9 +
10 +from fastapi import APIRouter, Depends, Header, HTTPException
11 +from pydantic import BaseModel, Field
12 +
13 +from aram_backend.mapping_access import AuthenticatedPrincipal, MappingAccess
14 +from aram_backend.mapping_store import MappingStore
15 +from aram_backend.mapping_workflow import MappingDecision, MappingWorkflowError
16 +
17 +router = APIRouter(prefix="/api/v1/mapping", tags=["mapping"])
18 +_identity_resolver: Callable[[str], AuthenticatedPrincipal | None] | None = None
19 +_store: MappingStore | None = None
20 +
21 +
22 +def configure_mapping_service(
23 + *, store: MappingStore, identity_resolver: Callable[[str], AuthenticatedPrincipal | None]
24 +) -> None:
25 + """Server-only composition root; never expose as a route."""
26 + global _identity_resolver, _store
27 + _store = store
28 + _identity_resolver = identity_resolver
29 +
30 +
31 +def reset_mapping_service() -> None:
32 + """Explicitly disable service, including when a credential provider fails."""
33 + global _identity_resolver, _store
34 + _store = None
35 + _identity_resolver = None
36 +
37 +
38 +def _service() -> tuple[MappingStore, MappingAccess]:
39 + if _store is None or _identity_resolver is None:
40 + raise HTTPException(status_code=503, detail="mapping service not configured")
41 + return _store, MappingAccess(_identity_resolver)
42 +
43 +
44 +def _credential(authorization: str | None = Header(default=None)) -> str:
45 + if not authorization or not authorization.startswith("Bearer "):
46 + raise HTTPException(status_code=401, detail="Bearer authentication required")
47 + token = authorization[7:]
48 + if not token or token != token.strip():
49 + raise HTTPException(status_code=401, detail="invalid bearer token")
50 + return token
51 +
52 +
53 +class Proposal(BaseModel):
54 + mapping_id: str = Field(min_length=1)
55 + account_full_code: str = Field(min_length=1)
56 + target_statement: str = Field(min_length=1)
57 + statement_section: str = Field(min_length=1)
58 + note_number: str = Field(min_length=1)
59 + subnote_code: str | None = None
60 + source: str = "Manual"
61 +
62 +
63 +class Revision(BaseModel):
64 + target_statement: str = Field(min_length=1)
65 + statement_section: str = Field(min_length=1)
66 + note_number: str = Field(min_length=1)
67 + subnote_code: str | None = None
68 +
69 +
70 +def _apply(company: str, year: int, token: str, action):
71 + store, access = _service()
72 + try:
73 + workspace, revision = store.load(company, year)
74 + result = action(access, workspace, token)
75 + store.save(workspace, revision)
76 + return result
77 + except MappingWorkflowError as exc:
78 + message = str(exc)
79 + if message in {"mapping access denied", "authenticated credential required"}:
80 + raise HTTPException(status_code=403, detail="access denied") from exc
81 + if "concurrent update" in message:
82 + raise HTTPException(status_code=409, detail="concurrent update") from exc
83 + raise HTTPException(status_code=422, detail=message) from exc
84 +
85 +
86 +@router.post("/{company}/{year}/proposals", response_model=MappingDecision)
87 +def propose(company: str, year: int, payload: Proposal, token: str = Depends(_credential)):
88 + def action(access, workspace, credential):
89 + return access.propose(credential, workspace, MappingDecision(
90 + payload.mapping_id, company, year, payload.account_full_code,
91 + payload.target_statement, payload.statement_section, payload.note_number,
92 + payload.subnote_code, 1, "Draft", None, payload.source,
93 + ))
94 + return _apply(company, year, token, action)
95 +
96 +
97 +@router.post("/{company}/{year}/{mapping_id}/review", response_model=MappingDecision)
98 +def review(company: str, year: int, mapping_id: str, token: str = Depends(_credential)):
99 + return _apply(company, year, token, lambda a, w, t: a.review(t, w, mapping_id))
100 +
101 +
102 +@router.post("/{company}/{year}/{mapping_id}/approve", response_model=MappingDecision)
103 +def approve(company: str, year: int, mapping_id: str, token: str = Depends(_credential)):
104 + return _apply(company, year, token, lambda a, w, t: a.approve(t, w, mapping_id))
105 +
106 +
107 +@router.post("/{company}/{year}/{mapping_id}/revise", response_model=MappingDecision)
108 +def revise(company: str, year: int, mapping_id: str, payload: Revision,
109 + token: str = Depends(_credential)):
110 + return _apply(company, year, token, lambda a, w, t: a.revise(
111 + t, w, mapping_id, target_statement=payload.target_statement,
112 + statement_section=payload.statement_section, note_number=payload.note_number,
113 + subnote_code=payload.subnote_code,
114 + ))
backend/src/aram_backend/mapping_integrity.py new
+55
@@ -0,0 +1,55 @@
1 +"""Deterministic SHA-256 audit chain and externally anchored integrity evidence.
2 +
3 +SHA-256 is not authentication. A privileged DB writer can recompute all hashes.
4 +A trusted operator must retain the terminal digest outside the database.
5 +"""
6 +from __future__ import annotations
7 +
8 +import hashlib
9 +import json
10 +from dataclasses import asdict
11 +from typing import Any
12 +
13 +from aram_backend.mapping_workflow import MappingAuditEvent, MappingWorkflowError
14 +
15 +GENESIS = "0" * 64
16 +
17 +
18 +def _canonical(event: MappingAuditEvent) -> bytes:
19 + return json.dumps(asdict(event), sort_keys=True, ensure_ascii=False,
20 + separators=(",", ":")).encode("utf-8")
21 +
22 +
23 +def audit_chain(events: tuple[MappingAuditEvent, ...]) -> tuple[str, ...]:
24 + previous = GENESIS
25 + digests = []
26 + for event in events:
27 + previous = hashlib.sha256(
28 + bytes.fromhex(previous) + _canonical(event)
29 + ).hexdigest()
30 + digests.append(previous)
31 + return tuple(digests)
32 +
33 +
34 +def verify_audit_chain(
35 + events: tuple[MappingAuditEvent, ...], stored: tuple[str, ...],
36 + *, trusted_terminal_digest: str | None = None,
37 +) -> str:
38 + expected = audit_chain(events)
39 + if expected != stored:
40 + raise MappingWorkflowError("audit hash chain mismatch")
41 + terminal = expected[-1] if expected else GENESIS
42 + if trusted_terminal_digest is not None and terminal != trusted_terminal_digest:
43 + raise MappingWorkflowError("audit external anchor mismatch")
44 + return terminal
45 +
46 +
47 +def integrity_receipt(
48 + *, company_code: str, fiscal_year: int, revision: int,
49 + terminal_digest: str,
50 +) -> dict[str, Any]:
51 + """Export receipt to an independent append-only system, not SQLite."""
52 + return {
53 + "company_code": company_code, "fiscal_year": fiscal_year,
54 + "revision": revision, "sha256": terminal_digest,
55 + }
backend/src/aram_backend/mapping_store.py
+51 -1
@@ -7,6 +7,7 @@ from contextlib import closing
7 from dataclasses import asdict
8 from pathlib import Path
9
10 +from aram_backend.mapping_integrity import GENESIS, audit_chain, verify_audit_chain
11 from aram_backend.mapping_workflow import (
12 MappingAuditEvent,
13 MappingDecision,
@@ -34,6 +35,11 @@ class MappingStore:
35 revision INTEGER NOT NULL, payload TEXT NOT NULL,
36 UNIQUE(company, year, revision)
37 );
38 + CREATE TABLE IF NOT EXISTS mapping_audit_hash (
39 + sequence INTEGER PRIMARY KEY,
40 + digest TEXT NOT NULL,
41 + FOREIGN KEY(sequence) REFERENCES mapping_audit(sequence)
42 + );
43 """)
44
45 def _connect(self):
@@ -133,12 +139,18 @@ class MappingStore:
139 "ON CONFLICT(company,year) DO UPDATE SET revision=excluded.revision,payload=excluded.payload",
140 (workspace.company_code, workspace.fiscal_year, new_revision, payload),
141 )
142 + digests = audit_chain(workspace.audit)
143 + old_count = len(workspace.audit) - len(appended)
144 for index, event in enumerate(appended):
137 - db.execute(
145 + cursor = db.execute(
146 "INSERT INTO mapping_audit(company,year,revision,payload) VALUES(?,?,?,?)",
147 (workspace.company_code, workspace.fiscal_year,
148 new_revision * 1000000 + index, json.dumps(event, ensure_ascii=False)),
149 )
150 + db.execute(
151 + "INSERT INTO mapping_audit_hash(sequence,digest) VALUES(?,?)",
152 + (cursor.lastrowid, digests[old_count + index]),
153 + )
154 db.commit()
155 return new_revision
156 except Exception:
@@ -172,6 +184,18 @@ class MappingStore:
184 )]
185 if state["audit"] != audit:
186 raise MappingWorkflowError("persisted audit/state mismatch")
187 + chain_rows = db.execute(
188 + "SELECT h.digest FROM mapping_audit a "
189 + "LEFT JOIN mapping_audit_hash h ON h.sequence=a.sequence "
190 + "WHERE a.company=? AND a.year=? ORDER BY a.sequence",
191 + (company, year),
192 + ).fetchall()
193 + if any(row[0] is None for row in chain_rows):
194 + raise MappingWorkflowError("audit hash chain missing event digest")
195 + verify_audit_chain(
196 + tuple(MappingAuditEvent(**item) for item in audit),
197 + tuple(row[0] for row in chain_rows),
198 + )
199 workspace, _ = self.load(company, year)
200 latest = {}
201 for event in workspace.audit:
@@ -215,3 +239,29 @@ class MappingStore:
239 except Exception:
240 target.unlink(missing_ok=True)
241 raise
242 +
243 +
244 + def audit_receipt(self, company: str, year: int) -> dict:
245 + """Operator must export the receipt to an independently protected store."""
246 + from aram_backend.mapping_integrity import integrity_receipt
247 +
248 + workspace, revision = self.load(company, year)
249 + self.verify_integrity()
250 + hashes = audit_chain(workspace.audit)
251 + return integrity_receipt(
252 + company_code=company, fiscal_year=year, revision=revision,
253 + terminal_digest=hashes[-1] if hashes else GENESIS,
254 + )
255 +
256 + def verify_external_receipt(self, receipt: dict) -> None:
257 + """Check a trusted externally retained receipt against current state."""
258 + company = receipt["company_code"]
259 + year = receipt["fiscal_year"]
260 + workspace, revision = self.load(company, year)
261 + self.verify_integrity()
262 + if revision != receipt["revision"]:
263 + raise MappingWorkflowError("audit external anchor revision mismatch")
264 + hashes = audit_chain(workspace.audit)
265 + verify_audit_chain(
266 + workspace.audit, hashes, trusted_terminal_digest=receipt["sha256"],
267 + )
backend/tests/test_mapping_api.py new
+67
@@ -0,0 +1,67 @@
1 +from aram_backend.main import app
2 +from aram_backend.mapping_access import AuthenticatedPrincipal
3 +from aram_backend.mapping_api import configure_mapping_service, reset_mapping_service
4 +from aram_backend.mapping_store import MappingStore
5 +from fastapi.testclient import TestClient
6 +
7 +
8 +def test_mapping_http_fail_closed_and_three_party_approval(tmp_path):
9 + client = TestClient(app)
10 + base = "/api/v1/mapping/001/1405"
11 + proposal = {
12 + "mapping_id": "M1", "account_full_code": "0010",
13 + "target_statement": "BS", "statement_section": "Assets", "note_number": "01",
14 + }
15 + reset_mapping_service()
16 + assert client.post(base + "/proposals", json=proposal).status_code == 401
17 + assert client.post(base + "/proposals", json=proposal,
18 + headers={"Authorization": "Bearer invalid"}).status_code == 503
19 + people = {
20 + "token-m": AuthenticatedPrincipal("maker", frozenset({"001"}), frozenset({"maker", "approver"})),
21 + "token-r": AuthenticatedPrincipal("reviewer", frozenset({"001"}), frozenset({"reviewer"})),
22 + "token-a": AuthenticatedPrincipal("approver", frozenset({"001"}), frozenset({"approver"})),
23 + "token-f": AuthenticatedPrincipal("foreign", frozenset({"002"}), frozenset({"maker"})),
24 + }
25 + store = MappingStore(tmp_path / "api.db")
26 + configure_mapping_service(store=store, identity_resolver=people.get)
27 + try:
28 + def post(path, token, data=None):
29 + return client.post(base + path, headers={"Authorization": "Bearer " + token},
30 + json=data)
31 + assert post("/proposals", "token-f", proposal).status_code == 403
32 + assert post("/proposals", "unknown", proposal).status_code == 403
33 + assert post("/proposals", "token-m", {**proposal, "actor": "approver"}).status_code == 200
34 + assert post("/M1/review", "token-m").status_code == 403
35 + assert post("/M1/approve", "token-a").status_code == 422
36 + assert post("/M1/review", "token-r").status_code == 200
37 + assert post("/M1/approve", "token-m").status_code == 422
38 + assert post("/M1/approve", "token-a").status_code == 200
39 + assert store.load("001", 1405)[0].decisions[0].status == "Approved"
40 + assert [e.actor for e in store.audit_log("001", 1405)] == [
41 + "maker", "reviewer", "approver",
42 + ]
43 + assert post("/M1/revise", "token-r", {
44 + "target_statement": "IS", "statement_section": "Revenue",
45 + "note_number": "02",
46 + }).status_code == 403
47 + finally:
48 + reset_mapping_service()
49 +
50 +
51 +def test_mapping_http_does_not_trust_header_actor_or_roles(tmp_path):
52 + store = MappingStore(tmp_path / "scope.db")
53 + configure_mapping_service(store=store, identity_resolver=lambda _: None)
54 + try:
55 + client = TestClient(app)
56 + response = client.post(
57 + "/api/v1/mapping/001/1405/proposals",
58 + headers={"Authorization": "Bearer fake", "X-Actor": "admin",
59 + "X-Roles": "approver", "X-Company": "001"},
60 + json={"mapping_id": "M1", "account_full_code": "0010",
61 + "target_statement": "BS", "statement_section": "Assets",
62 + "note_number": "01"},
63 + )
64 + assert response.status_code == 403
65 + assert store.load("001", 1405)[0].decisions == ()
66 + finally:
67 + reset_mapping_service()
backend/tests/test_mapping_hash_chain.py new
+43
@@ -0,0 +1,43 @@
1 +import sqlite3
2 +
3 +import pytest
4 +from aram_backend.mapping_store import MappingStore
5 +from aram_backend.mapping_workflow import MappingDecision, MappingWorkflowError
6 +
7 +
8 +def decision():
9 + return MappingDecision("M1", "001", 1405, "0010", "BS", "Assets",
10 + "01", None, 1, "Draft", None, "Manual")
11 +
12 +
13 +def test_audit_hash_chain_receipt_and_restore(tmp_path):
14 + store = MappingStore(tmp_path / "original.db")
15 + workspace, revision = store.load("001", 1405)
16 + workspace.propose(decision(), actor="maker")
17 + revision = store.save(workspace, revision)
18 + workspace.transition("M1", "Reviewed", actor="reviewer")
19 + store.save(workspace, revision)
20 + receipt = store.audit_receipt("001", 1405)
21 + assert len(receipt["sha256"]) == 64
22 + store.verify_external_receipt(receipt)
23 + store.backup_to(tmp_path / "backup.db")
24 + restored = MappingStore(tmp_path / "backup.db")
25 + restored.verify_external_receipt(receipt)
26 + with pytest.raises(MappingWorkflowError, match="external anchor"):
27 + store.verify_external_receipt({**receipt, "sha256": "f" * 64})
28 +
29 +
30 +def test_detects_tampered_chain_and_missing_digest(tmp_path):
31 + path = tmp_path / "tamper.db"
32 + store = MappingStore(path)
33 + workspace, revision = store.load("001", 1405)
34 + workspace.propose(decision(), actor="maker")
35 + store.save(workspace, revision)
36 + with sqlite3.connect(path) as db:
37 + db.execute("UPDATE mapping_audit_hash SET digest=?", ("f" * 64,))
38 + with pytest.raises(MappingWorkflowError, match="hash chain mismatch"):
39 + store.verify_integrity()
40 + with sqlite3.connect(path) as db:
41 + db.execute("DELETE FROM mapping_audit_hash")
42 + with pytest.raises(MappingWorkflowError, match="missing event digest"):
43 + store.verify_integrity()
docs/GATE3_PACKAGE5_ACCEPTANCE.md new
+53
@@ -0,0 +1,53 @@
1 +# Gate 3 — Package 5 acceptance matrix and Gate 4 handoff
2 +
3 +Date: 2026-11-01. Branch: feat/gate3-governed-mapping-20261101.
4 +Approved base: source-data-cleanup@7dc864fd032f0c4ae4d650d89304a01286a6d914.
5 +Starting candidate: b25ce454ff182f1d3c611b872f44b78c0d8c0fe1.
6 +PR: https://github.com/davoodmehraban89/Aram/pull/82 (Draft).
7 +
8 +## Review A — financial correctness (self-audit, not independent)
9 +- Checked company/year isolation, three-party workflow, conservative account ambiguity classification, mapping notes and account hierarchy in Excel roundtrip.
10 +- No authorized real-ledger sample supplied. The synthetic test suite is not proof of correctness of financial statement mapping.
11 +- No imported workbook approval can be treated as independently authenticated approval.
12 +
13 +## Review B — security/architecture (self-audit, not independent)
14 +- New API router exposes guarded propose/review/approve/revise endpoints, registered on FastAPI app.
15 +- The only actor used is the subject returned by server-configured identity resolver. Bearer tokens and untrusted header/body role claims cannot directly set actor or permissions. Unconfigured resolver returns 503 (fail closed). Company and role scopes enforced by MappingAccess.
16 +- No production IdP/OIDC configuration, signing-key trust chain, token expiry/audience verification, or deployment secret management was available. Trusted resolver must be installed by deployment operators. No claim of production identity integration.
17 +- SHA-256 hash chain added for audit events, stored in separate mapping_audit_hash table. External terminal-digest receipts can be exported and checked. No secure external receipt repository was available; a privileged DB writer can rewrite the entire DB and recalculate hashes. This is detection with a trusted external anchor, not independent tamper-proofing.
18 +- Existing databases with pre-chain events require an explicit reviewed migration/backfill plan; the implementation does not silently rewrite existing historical audit events.
19 +
20 +## Review C — adversarial/recovery (self-audit, not independent)
21 +- HTTP tests cover missing/forged token, unauthorized role/company, maker reviewing/approving own mapping, independent approval and persistence.
22 +- Hash chain tests cover digest tamper, missing digest, external receipt mismatch and verified SQLite online backup/restore.
23 +- Existing tests cover stale writers, scope and Excel roundtrip. No full production crash/power-loss or operational disaster-recovery drill performed.
24 +
25 +## Acceptance matrix
26 +
27 +| Criterion | Evidence | Result |
28 +| --- | --- | --- |
29 +| Approved base and isolated branch | git refs / PR #82 | PASS |
30 +| Protected mapping HTTP endpoints | mapping_api.py, test_mapping_api.py | PASS in isolated tests |
31 +| Production IdP with validated bearer tokens | External deployment credentials not provided | BLOCKED |
32 +| Scoped role segregation | mapping_access.py and HTTP tests | PASS in isolated tests |
33 +| Audit SHA-256 chain and external anchor verification API | mapping_integrity.py, mapping_store.py and tests | PASS in isolated tests |
34 +| Privileged-DB tamper resistance with separately protected anchor | External trusted storage not connected | BLOCKED |
35 +| Company/year and duplicate/ambiguous financial mapping | mapping_quality.py, workflow and tests | PASS in synthetic tests |
36 +| Authorized real-ledger reconciliation and financial signoff | No authorized sample or signed decision | BLOCKED |
37 +| Excel roundtrip / review evidence | mapping_workflow.py and tests | PASS in synthetic tests |
38 +| SQLite backup, restore and tamper injection | test_mapping_recovery_quality.py, test_mapping_hash_chain.py | PASS in isolated tests |
39 +| Production operational recovery drill | No production or staging operational authorization | BLOCKED |
40 +| Three independent reviewer approvals | Three self-audits only; independent reviewer identities absent | BLOCKED |
41 +| Final-head CI and test evidence | Must record URL and conclusion on PR after push | PENDING |
42 +
43 +Decision: **NO-GO / CHANGES REQUESTED**. Gate 3 is NOT accepted. PR remains Draft. Do not merge, release or start Gate 4 implementation.
44 +
45 +## Gate 4 handoff — preparation only
46 +- Use reviewed approved mappings as sole input to financial statements; never infer approval from Excel.
47 +- Production prerequisite: external IdP/OIDC or equivalent verified identity resolver, role/company claims and revocation policy.
48 +- Audit prerequisite: independent immutable/WORM or signed off-DB anchor receipt repository with periodic verification and retention.
49 +- Finance prerequisite: owner-approved real-ledger reconciliation, unresolved mapping queue disposition, source hashes and signed financial mapping decision.
50 +- Operations prerequisite: staging backup/restore with recovery time/recovery point targets and incident evidence.
51 +- Governance prerequisite: independent reviewer records exact SHA, diff, tests, risks, identity and decision in PR.
52 +
53 +Rollback: revert isolated feature-branch commits; no production financial data or canonical workbook changed.
docs/PROJECT_LOG.md
+9
@@ -294,3 +294,12 @@ Each new entry must record: UTC timestamp, actor, task/phase, base branch and SH
294 - Three sequential self-audits in docs/GATE3_PACKAGE4_REVIEW.md; not independent review.
295 - No financial-data or canonical artifact modification; no production database migrations.
296 - Formal status CHANGES REQUESTED pending independent review and remaining security/financial/operational evidence. Rollback by reverting focused feature-branch commits.
297 +
298 +## 2026-11-01 — Gate 3 Package 5
299 +- Isolated branch, approved base and PR #82 checked before modifications; no unrelated local edits at start.
300 +- New mapping API routes protected by injected identity resolver and fail-closed default; added HTTP role/scope regression tests.
301 +- SHA-256 event audit chain and external terminal receipt verification added with integrity/restore tests. Historical-event backfill deliberately not automated.
302 +- Reviewed finance/scope/Excel, architecture/security, adversarial/recovery as three self-audit perspectives only; independent approval remains absent.
303 +- Acceptance evidence and Gate 4 handoff: docs/GATE3_PACKAGE5_ACCEPTANCE.md.
304 +- No canonical XLSX/PDF, financial data, production database, Merge or Release changed. Rollback: revert feature-branch commits.
305 +- Decision NO-GO pending external IdP, external audit anchor, authorized financial reconciliation, operational DR drill and independent review.