Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
dev/v7-production-failclosed-20261021
ci/public-windows-bridge-probe-20261017
ci/windows-dispatch-bootstrap-20261016
ci/windows-dual-app-lab-20261016
dev/v7-production-failclosed-20261021
feature/reconciliation-guard-20261013
main
phase-1-foundation
phase-1-implementation
phase-2-treasury-core
phase-3-banking-reconciliation
phase-4-operations-enterprise-ux
phase-5-hardening-release
phase-6-production-platform
phase-7-production-infrastructure-bank-golive
phase-7-sql-readonly-ux-20261015
transfer-exe-to-drive-20261006
| 1 | import {describe,it,expect} from 'vitest'; |
| 2 | import {isProductionOperationBlocked as blocked} from './production-http-guard'; |
| 3 | const production={NODE_ENV:'production',TREASURYFLOW_DESKTOP_LOCAL:'0'}; |
| 4 | describe('production access fails closed at ingress',()=>{ |
| 5 | it('blocks financial and action endpoints before any data access',()=>{ |
| 6 | for(const path of ['/','/dashboard','/accounts','/payments','/payments/new', |
| 7 | '/queue','/audit','/api/payments','/api/transfer/submit','/reports/export', |
| 8 | '/integrations','/master-data','/reconciliation','/%2e%2e/payments']){ |
| 9 | expect(blocked(production,path),path).toBe(true); |
| 10 | } |
| 11 | }); |
| 12 | it('exposes only login view and readiness (not operations)',()=>{ |
| 13 | expect(blocked(production,'/login')).toBe(false); |
| 14 | expect(blocked(production,'/api/ready')).toBe(false); |
| 15 | expect(blocked(production,'/api/ready/secret')).toBe(true); |
| 16 | expect(blocked(production,'/login/dashboard')).toBe(true); |
| 17 | }); |
| 18 | it('cannot be bypassed by unrelated environment flags',()=>{ |
| 19 | for(const x of [{}, {BANK_ADAPTER_MODE:'disabled'}, {IDENTITY_PROVIDER:'oidc-ref'}, |
| 20 | {AUTH_PROXY_HMAC_SECRET:'configured'}, {TREASURYFLOW_DESKTOP_LOCAL:'true'}]){ |
| 21 | expect(blocked({...production,...x},'/payments')).toBe(true); |
| 22 | } |
| 23 | }); |
| 24 | it('never treats live-bank mode as an operational authorization, even on desktop',()=>{ |
| 25 | for(const local of ['1','0',undefined]){ |
| 26 | for(const nodeMode of ['production','development']){ |
| 27 | const e={NODE_ENV:nodeMode,TREASURYFLOW_DESKTOP_LOCAL:local,BANK_ADAPTER_MODE:'live'}; |
| 28 | expect(blocked(e,'/payments')).toBe(true); |
| 29 | expect(blocked(e,'/api/transfer/submit')).toBe(true); |
| 30 | expect(blocked(e,'/api/ready')).toBe(false); |
| 31 | } |
| 32 | } |
| 33 | }); |
| 34 | it('preserves isolated local desktop and developer flow',()=>{ |
| 35 | expect(blocked({NODE_ENV:'development'},'/dashboard')).toBe(false); |
| 36 | expect(blocked({NODE_ENV:'production',TREASURYFLOW_DESKTOP_LOCAL:'1'},'/payments')).toBe(false); |
| 37 | }); |
| 38 | }); |