Treasury & Bank Transfer Management System — سامانه مدیریت خزانه‌داری و حواله‌های بانکی

Fail-close HTTP access under unauthorized live bank mode even in local desktop configuration

davoodmehraban89 committed Oct 21, 2026 at 08:51 UTC d8da1699534fe55846201943d4fc57c4353f3801
1 file changed +3 -1
src/platform/identity/production-http-guard.ts
+3 -1
@@ -3,7 +3,9 @@ export function isProductionOperationBlocked(
3 env: Readonly<Record<string,string|undefined>>,
4 pathname: string
5 ): boolean {
6 - if (env.NODE_ENV !== 'production' || env.TREASURYFLOW_DESKTOP_LOCAL === '1') return false;
6 + const externalProduction = env.NODE_ENV === 'production' && env.TREASURYFLOW_DESKTOP_LOCAL !== '1';
7 + const unauthorizedBankLive = env.BANK_ADAPTER_MODE === 'live';
8 + if (!externalProduction && !unauthorizedBankLive) return false;
9 // Only a public readiness endpoint and the login view are non-operational.
10 return pathname !== '/api/ready' && pathname !== '/login';
11 }