@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / 2baa4c7
Fork 0

سامانه صدور فاکتور و حسابداری

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 4, 08:00 UTC

docs(finora): record real JWT posted inventory authorization P0 and Issue245

davoodmehraban89 committed Nov 23, 2026 at 18:33 UTC 2baa4c7bdc35cc07313c3e82614a4fdec207acfe
1 file changed +7
PROJECT_STATE.md
+7
@@ -873,3 +873,10 @@ Next action: run and inspect Quality on the latest PR212 head. If any browser te
873 - **Scope:** new QA-only child branch `qa/finora-phase5-posted-insert-jwt-red-20261123` from exact PR243 SHA `b4da4aeb...`. Only a NEW `scripts/wp2-phase5-posted-insert-approval-jwt-e2e.mjs`, one new WP2 workflow step/path trigger, and append-only `PROJECT_STATE.md` and existing `docs/EXECUTION_STATUS.md`. NO application stock/financial JS, SQL/migrations, RLS/Auth/grants, Production, main, posted customer history, merge or release. Codex-main sole financial product implementation/review owner.
874 - **Test design:** disposable-local only with explicit localhost API/DB guards. Real Auth-issued JWT non-owner member D in org A has **inventory:create scoped to company A1 only** and NO `inventory:approve`. A real owner A sees source readback. D attempts direct PostgREST INSERT `status:posted` for EACH `stockMovements` and `inventoryCounts`, with unique fixture IDs under company A1. Current known-broken fingerprint is HTTP201/204 **plus** one exact persisted posted data row read by A. Mark it explicitly `FINORA_PHASE5_POSTED_INSERT_WITHOUT_APPROVE_EXPECTED_RED` (source/product RED, not a permission PASS). Proper fixed behavior is HTTP401/403 with owner readback empty. Any partial, authorization bypass outside intended scope, or third state is ordinary CI FAIL with no generic xfail. Seed only fixture company/warehouse/product, no financial journal or fake approval. Use existing real DB policies and license triggers, not SQL permission overrides. Evaluate whether company-scoped create can create only A1 in separate acceptance if necessary; avoid claiming unauthenticated/foreign-org exploit.
875 - **No status inflation:** A90/B50/C20/D55/E53/F10 unchanged (QA evidence ≠ feature completion). Record first exact workflow trace, fix only fixture assumptions if necessary, rerun same SHA gates, Draft PR and owner review; never merge/deploy.
876 +
877 +
878 +### 2026-11-23 — FIN-QA-PHASE5-POSTED-INSERT-JWT / confirmed product security P0, disposable Auth evidence
879 +- **Actual executed new real JWT test:** QA child [Draft PR244](https://github.com/davoodmehraban89/Factor-easy/pull/244), tested SHA `afe2efbf3b4e71f203854126bed6ccc74434ad41`, [WP2 #45200147190](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45200147190) **COMPLETED SUCCESS (expected-product-RED reproduction)**. Auth-issued JWT of a non-owner member with **company A1-scoped inventory:create only** and **no inventory:approve** successfully **INSERTed posted** records in both `stockMovements` and `inventoryCounts` via PostgREST, HTTP201 for both; real separate owner JWT read back exactly persisted posted payloads. Log `FINORA_PHASE5_POSTED_INSERT_WITHOUT_APPROVE_EXPECTED_RED`, exact two-case evidence `stockMovements=201:posted_without_approval` and `inventoryCounts=201:posted_without_approval`. This is a **confirmed PRODUCT SECURITY/LIFECYCLE P0**, not authorized posting, not a passing business security gate, not evidence of cross-organization bypass. Both known Issue229 sale and purchase independent approval P0 expected-REDs appeared in same run.
880 +- **Root cause evidence and missing boundary:** `20260930031853_organization_membership_rbac_foundation.sql` `records_insert` checks collection-level `create`, not approval on `data.status=posted`, and `20260929172129_phase5_complementary_erp_collections.sql` existing Phase5 guard blocks UPDATE/DELETE of pre-existing posted rows, not initial INSERT posted. The test did not modify either SQL file. PR243's real-JWT organization/company read-only isolation and posted UPDATE/DELETE safeguards remain valid and distinct from this INSERT status authorization defect.
881 +- **Action taken:** Opened [Issue245](https://github.com/davoodmehraban89/Factor-easy/issues/245) with exact acceptance for Codex-main to forbid unauthorized direct posted stock/count writes and implement independent server-side finalize audit, transactional source link, idempotency and fiscal lock. Test must become ordinary authorized denial PASS `FINORA_PHASE5_POSTED_INSERT_APPROVAL_PASS` after correction. Explicit positive authorized finalize independently needed. Existing browser PR240/242 issues and Issue229 remain uncorrected.
882 +- **CI at tested SHA:** WP2 #45200147190 SUCCESS proving expected known product RED, Security [#45200146799](https://github.com/davoodmehraban89/Factor-easy/actions/runs/45200146799) SUCCESS (not a business authorization proof); Quality #45200146962, WP1 #45200147309 IN PROGRESS at recording. New docs-inclusive SHA must pass exact-head Quality/WP1/WP2/Security separately. Draft and Codex-main final review mandatory. No app JS, migrations, SQL/RLS/Auth/grants, customer posted history, Production, main merge/release/deploy changed. Six-phase product progress **A90/B50/C20/D55/E53/F10 unchanged**.