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
md 5.14 KB

Package 9.1 — Security execution evidence (2026-11-03)

Decision

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.

Baseline and branch

  • Repository: davoodmehraban89/Aram
  • Parent PR: #89, draft, base SHA a0b72be87720b1ff08361298b903ba57dd4fb408
  • Working branch: feat/gate3-package9-1-security-20261103
  • Parent commit before this implementation: f3f37ee8fb4894006d4faa866dfa140926b1d96a
  • Worktree: C:\Users\Davood\Documents\Aram-Gate3-Package9-1-Security
  • Canonical financial data not modified. No merge or release performed.

Implemented

  1. LocalSessionAuthority now provisions Argon2id hashes and verifies passwords through the dedicated security module.
  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.
  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.
  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).
  5. Windows DPAPI CurrentUser encrypted credential vault supports atomic save/load and detects ciphertext tampering.
  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.
  7. Regression tests added for API login/logout, bearer token revocation, PBKDF2 migration, DPAPI round-trip/tamper, and portable recovery.

Verification

  • Full backend test suite: 136 tests passed (including Windows DPAPI tests on the connected Windows host).
  • Ruff: PASS.
  • compileall: PASS.
  • pip check: PASS.
  • git diff --check: PASS.
  • One existing Starlette/httpx TestClient deprecation warning remains.
  • Test run is local on Aram; this is not remote CI proof for the new candidate until GitHub Actions completes on the final SHA.

Three review passes (sequential self-review, not independent)

Reviewer 1 — Functional QA

  • Confirmed successful Argon2id login, PBKDF2 upgrade after successful login only, API login/logout, mapping API session use, and fail-closed behavior when not configured.
  • 136/136 local tests passed.

Reviewer 2 — Security and architecture

  • Confirmed DPAPI CurrentUser protection and authenticated tamper detection, passphrase-encrypted recovery envelope, no credential plaintext in the vault, and explicit opt-in configuration.
  • 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.

Reviewer 3 — Adversarial and misuse

  • 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.
  • Remaining adversarial gap: multi-user/concurrent worker behavior and process restart/session invalidation were not tested as production deployment behavior.

Critical limitations / acceptance blockers

  • 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.
  • 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.
  • 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.
  • 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.
  • No independent reviewer has approved the candidate.
  • CI must pass on the final SHA before the code-quality gate can pass.

Safe boundaries

  • No real financial data was accessed or modified.
  • No production login credential was changed.
  • No merge, release or force push.
  • The app remains fail-closed if no DPAPI vault is configured.
  • Gate 3 remains NO-GO until the blockers above and the other Gate 3 financial/audit/DR requirements have evidence.