feat/gate3-package9-1-security-20261103
add-index-html-10623938925177053894
arena/094f314c-aram
chatgpt-phase1b2-autopilot
codex/adr-future-connectors-pi-v1
codex/aram-account-note-source-trace-20261031
codex/aram-actions-node24-maintenance-20261031
codex/aram-analyst-review-workbook-20261031
codex/aram-bs-candidate-statement-20261031
codex/aram-cash-flow-direct-candidate-20261031
codex/aram-clean-reference-year-integrity-20261030
codex/aram-cross-statement-controls-20261031
codex/aram-equity-changes-candidate-20261031
codex/aram-five-statement-cli-20261031
codex/aram-five-statement-integration-20261031
codex/aram-five-statement-orchestrator-20261031
codex/aram-gate3-coverage-target-guard-20261030
codex/aram-gate3-hidden-xlsx-guard-20261030
codex/aram-gate3-integration-validation-20261030
codex/aram-gate3-mapping-change-preview-20261030
codex/aram-gate3-stale-note-guard-20261030
codex/aram-income-statement-candidate-20261031
codex/aram-manifest-referential-integrity-20261031
codex/aram-mapping-source-parser-20261101
codex/aram-multidimensional-mapping-20261101
codex/aram-multistatement-mapping-20261031
codex/aram-pipeline-manifest-schema-20261031
codex/aram-readonly-mapping-coverage-20261031
codex/aram-reconciliation-review-gate-20261031
codex/aram-same-flush-fiscal-lock-20261030
codex/aram-synthetic-windows-demo-20261031
codex/aram-trial-balance-diagnostic-20261031
codex/aram-windows-background-detail-search-20261031
codex/aram-windows-detail-review-20261031
codex/aram-windows-five-statement-pilot-20261031
codex/aram-windows-statement-figures-20261031
codex/gate-2a-pilot-workbook
codex/gate-2a-pilot-workbook-6864754244772568979
codex/gate3-authenticated-principal-boundary-20261030
codex/gate3-authored-draft-staging-20261030
codex/gate3-carry-forward-preview-20261023
codex/gate3-draft-staging-audit-20261030
codex/gate3-mapping-batch-freshness-20261030
codex/gate3-mapping-batch-review-20261030
codex/gate3-mapping-core
codex/gate3-mapping-coverage-20261023
codex/gate3-mapping-excel-20261023
codex/gate3-note-mapping-review-20261023
codex/gate3-signed-year-scope-20261030
codex/gate3-unapproved-proposal-storage-20261030
codex/payvast-mapping-discovery-20261023
codex/phase-2a-backend-foundation
codex/phase-2b-post-merge-record
codex/phase-2b-source-registration
codex/phase-2b-source-registration-12955190277775369594
codex/post-gate2a-control-reconciliation
codex/post-pr18-acceptance-record
codex/project-control-foundation
codex/t1-repo-hygiene-20261023
codex/t2-ci-hardening-20261023
codex/t3-explicit-migrations-20261023
codex/t6a-readonly-diagnostics-20261023
codex/v1-01-safety-gate-hardening
codex/v1-year-isolation-followup-20261023
codex/windows-native-pilot-shell-20261030
docs/aram-master-control-plan-20261111
docs/aram-roadmap-dashboard-20261030
docs/financial-statement-reconciliation-1402-1404-20261110
feat/gate3-governed-mapping-20261101
feat/gate3-package9-1-security-20261103
feat/gate3-package9-isolated-20261103
fix/password-unicode-validation-20261111
governance/aram-5-1-3-controls-20261030
governance/role-based-operating-model
jules-1168663913887856558-73b8a885
jules-gate-2b-mapping-workflow-foundation-4137724387867065330
phase-1b1-audit-report-7365389436990903239
phase-2a-backend-foundation-10237597358138521261
phase1b2-postmerge-metadata-fix
refactor/drg-parent-year-id-15088443704684163304
source-data-cleanup
| 1 | # Package 9.1 — Security execution evidence (2026-11-03) |
| 2 | |
| 3 | ## Decision |
| 4 | **PARTIAL / NO-GO for Gate 3.** The Argon2id login path, FastAPI login/logout integration, DPAPI CurrentUser credential vault, and passphrase-encrypted portable recovery-envelope primitives are implemented and locally tested. This is not yet an operational multi-user identity service and does not satisfy independent recovery evidence or independent review. |
| 5 | |
| 6 | ## Baseline and branch |
| 7 | - Repository: davoodmehraban89/Aram |
| 8 | - Parent PR: #89, draft, base SHA `a0b72be87720b1ff08361298b903ba57dd4fb408` |
| 9 | - Working branch: `feat/gate3-package9-1-security-20261103` |
| 10 | - Parent commit before this implementation: `f3f37ee8fb4894006d4faa866dfa140926b1d96a` |
| 11 | - Worktree: `C:\Users\Davood\Documents\Aram-Gate3-Package9-1-Security` |
| 12 | - Canonical financial data not modified. No merge or release performed. |
| 13 | |
| 14 | ## Implemented |
| 15 | 1. `LocalSessionAuthority` now provisions Argon2id hashes and verifies passwords through the dedicated security module. |
| 16 | 2. Legacy PBKDF2 credentials can be imported without plaintext; on successful login the hash is upgraded to Argon2id in memory. Wrong passwords do not trigger migration. |
| 17 | 3. FastAPI `/api/v1/auth/login` and `/logout` routes are added. Mapping API uses the resulting opaque session token through the trusted server-side resolver; actor/role/company headers remain untrusted. |
| 18 | 4. Startup can opt into a DPAPI vault using `ARAM_CREDENTIAL_VAULT_PATH`; mapping database path is configurable with `ARAM_MAPPING_STORE_PATH`. With no vault configured, authentication stays fail-closed (503). |
| 19 | 5. Windows DPAPI CurrentUser encrypted credential vault supports atomic save/load and detects ciphertext tampering. |
| 20 | 6. Portable recovery envelope uses Scrypt + AES-256-GCM with a separate passphrase; tests verify round-trip, wrong passphrase, tampering and malformed input. No cloud upload or off-device copy was performed. |
| 21 | 7. Regression tests added for API login/logout, bearer token revocation, PBKDF2 migration, DPAPI round-trip/tamper, and portable recovery. |
| 22 | |
| 23 | ## Verification |
| 24 | - Full backend test suite: **136 tests passed** (including Windows DPAPI tests on the connected Windows host). |
| 25 | - Ruff: PASS. |
| 26 | - compileall: PASS. |
| 27 | - pip check: PASS. |
| 28 | - git diff --check: PASS. |
| 29 | - One existing Starlette/httpx TestClient deprecation warning remains. |
| 30 | - Test run is local on Aram; this is not remote CI proof for the new candidate until GitHub Actions completes on the final SHA. |
| 31 | |
| 32 | ## Three review passes (sequential self-review, not independent) |
| 33 | ### Reviewer 1 — Functional QA |
| 34 | - Confirmed successful Argon2id login, PBKDF2 upgrade after successful login only, API login/logout, mapping API session use, and fail-closed behavior when not configured. |
| 35 | - 136/136 local tests passed. |
| 36 | |
| 37 | ### Reviewer 2 — Security and architecture |
| 38 | - Confirmed DPAPI CurrentUser protection and authenticated tamper detection, passphrase-encrypted recovery envelope, no credential plaintext in the vault, and explicit opt-in configuration. |
| 39 | - Findings still open: session/lockout state is process-memory only; one local credential identity is supported; there is no cross-process throttling, account lifecycle, MFA, enterprise IdP, account recovery workflow/UI, independent cloud escrow, or proof of restrictive NTFS ACL on deployment path. DPAPI recovery is tied to the Windows user profile; portable envelope passphrase must be separately retained. |
| 40 | |
| 41 | ### Reviewer 3 — Adversarial and misuse |
| 42 | - Tested malformed stored hashes, wrong passwords, oversized passwords, bad recovery passphrases, ciphertext tampering, malformed recovery envelope, unconfigured API, unknown bearer tokens, logout/replay, and company-scope rejection. |
| 43 | - Remaining adversarial gap: multi-user/concurrent worker behavior and process restart/session invalidation were not tested as production deployment behavior. |
| 44 | |
| 45 | ## Critical limitations / acceptance blockers |
| 46 | - This local adapter supports one credential/subject per authority. It cannot by itself provide independent maker, reviewer, and approver identities. A trusted multi-user IdP or a properly designed multi-account authority is required before workflow deployment. |
| 47 | - PBKDF2 migration updates the active in-memory credential only. Persisting the upgraded hash back into the DPAPI vault atomically is not yet wired; a restart before that persistence would require another PBKDF2 verification. |
| 48 | - The portable recovery envelope is a tested library primitive, not yet part of an attended backup procedure. Its passphrase must be stored separately; no independent cloud copy or restore witness exists. |
| 49 | - DPAPI vault is CurrentUser-bound. Loss of the Windows profile may prevent DPAPI unprotect; portable envelope is the recovery route but has not been copied to an independent destination or tested on a second Windows profile/device. |
| 50 | - No independent reviewer has approved the candidate. |
| 51 | - CI must pass on the final SHA before the code-quality gate can pass. |
| 52 | |
| 53 | ## Safe boundaries |
| 54 | - No real financial data was accessed or modified. |
| 55 | - No production login credential was changed. |
| 56 | - No merge, release or force push. |
| 57 | - The app remains fail-closed if no DPAPI vault is configured. |
| 58 | - Gate 3 remains **NO-GO** until the blockers above and the other Gate 3 financial/audit/DR requirements have evidence. |