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 | name: V7 patched MSAL transitive dependency real SQL Server least privilege regression |
| 2 | on: |
| 3 | push: |
| 4 | paths: |
| 5 | - .github/workflows/v7-patched-msal-real-sqlserver-lab-once.yml |
| 6 | permissions: |
| 7 | contents: read |
| 8 | jobs: |
| 9 | mssql: |
| 10 | runs-on: ubuntu-22.04 |
| 11 | timeout-minutes: 30 |
| 12 | steps: |
| 13 | - uses: actions/checkout@v4 |
| 14 | with: |
| 15 | persist-credentials: false |
| 16 | - uses: actions/setup-node@v4 |
| 17 | with: |
| 18 | node-version: '22' |
| 19 | - name: Install and enforce patched transitive MSAL and zero production advisories |
| 20 | shell: bash |
| 21 | run: | |
| 22 | set -euo pipefail |
| 23 | npm ci --ignore-scripts --no-fund --no-audit >/dev/null |
| 24 | node - <<'NODE' |
| 25 | const pkg=require('./node_modules/@azure/msal-node/package.json'); |
| 26 | if(pkg.version!=='7.1.1')throw Error('PATCHED_MSAL_LOCK_NOT_INSTALLED'); |
| 27 | console.log('GATE_PASS_MSAL_7_1_1_ACTUALLY_INSTALLED'); |
| 28 | NODE |
| 29 | npm audit --omit=dev --audit-level=low > "$RUNNER_TEMP/mssql-audit-private.log" 2>&1 |
| 30 | echo GATE_PASS_SQL_DRIVER_ZERO_PRODUCTION_DEPENDENCY_ADVISORIES |
| 31 | - name: Start actual SQL Server 2022 engine with synthetic view-only login |
| 32 | shell: bash |
| 33 | run: | |
| 34 | set -euo pipefail |
| 35 | sa='A@'$(openssl rand -hex 18)'b3' |
| 36 | ro='R@'$(openssl rand -hex 18)'c4' |
| 37 | echo "::add-mask::$sa" |
| 38 | echo "::add-mask::$ro" |
| 39 | echo "TF_SQL_SYNTH_SA=$sa" >> "$GITHUB_ENV" |
| 40 | echo "TF_SQL_SYNTH_RO=$ro" >> "$GITHUB_ENV" |
| 41 | docker pull mcr.microsoft.com/mssql/server:2022-latest > "$RUNNER_TEMP/mssql-pull-private.log" 2>&1 |
| 42 | docker run -d --name v7-synthetic-msal-sql -e ACCEPT_EULA=Y -e MSSQL_PID=Developer -e MSSQL_SA_PASSWORD="$sa" -p 127.0.0.1:1433:1433 mcr.microsoft.com/mssql/server:2022-latest > "$RUNNER_TEMP/mssql-container-private.log" 2>&1 |
| 43 | good=false |
| 44 | for n in $(seq 1 95); do |
| 45 | if docker exec v7-synthetic-msal-sql /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$sa" -C -b -Q 'SELECT 1;' > "$RUNNER_TEMP/mssql-ready-private.log" 2>&1; then good=true; break; fi |
| 46 | sleep 2 |
| 47 | done |
| 48 | test "$good" = true |
| 49 | cat > "$RUNNER_TEMP/msal-sql-synthetic.sql" <<'SQL' |
| 50 | CREATE DATABASE TreasuryFlowMsalSafety; |
| 51 | GO |
| 52 | USE TreasuryFlowMsalSafety; |
| 53 | GO |
| 54 | CREATE TABLE dbo.SyntheticTransfers(Row_ID int PRIMARY KEY, Client_Reference varchar(64) NOT NULL, Amount_IRR bigint NOT NULL); |
| 55 | INSERT INTO dbo.SyntheticTransfers VALUES(1,'CI-SYNTHETIC-ONLY',1250000); |
| 56 | GO |
| 57 | CREATE VIEW dbo.vw_ReadOnlyTransfers AS SELECT Row_ID, Client_Reference, Amount_IRR FROM dbo.SyntheticTransfers; |
| 58 | GO |
| 59 | SQL |
| 60 | docker cp "$RUNNER_TEMP/msal-sql-synthetic.sql" v7-synthetic-msal-sql:/tmp/v7sql.sql |
| 61 | docker exec v7-synthetic-msal-sql /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$sa" -C -b -i /tmp/v7sql.sql > "$RUNNER_TEMP/mssql-init-private.log" 2>&1 |
| 62 | docker exec v7-synthetic-msal-sql /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$sa" -C -b -Q "CREATE LOGIN [tf_v7_synthetic_reader] WITH PASSWORD=N'$ro';" > "$RUNNER_TEMP/mssql-setup-private.log" 2>&1 |
| 63 | docker exec v7-synthetic-msal-sql /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$sa" -C -b -d TreasuryFlowMsalSafety -Q 'CREATE USER tf_v7_synthetic_reader FOR LOGIN tf_v7_synthetic_reader; GRANT SELECT ON dbo.vw_ReadOnlyTransfers TO tf_v7_synthetic_reader;' > "$RUNNER_TEMP/mssql-grants-private.log" 2>&1 |
| 64 | echo GATE_PASS_REAL_SQL2022_TEMPORARY_SYNTHETIC_VIEW_CREATED |
| 65 | - name: Confirm patched driver reads approved SQL view, denies writes and base table reads |
| 66 | shell: bash |
| 67 | run: | |
| 68 | set -euo pipefail |
| 69 | node - <<'NODE' |
| 70 | const assert=require('node:assert/strict'),sql=require('mssql'); |
| 71 | (async()=>{ |
| 72 | const pool=await sql.connect({user:'tf_v7_synthetic_reader',password:process.env.TF_SQL_SYNTH_RO, |
| 73 | server:'127.0.0.1',database:'TreasuryFlowMsalSafety', |
| 74 | options:{encrypt:false,trustServerCertificate:true}, |
| 75 | pool:{max:2,min:0,idleTimeoutMillis:1000}}); |
| 76 | try{ |
| 77 | const rows=(await pool.request().query('SELECT Row_ID,Client_Reference,Amount_IRR FROM dbo.vw_ReadOnlyTransfers')).recordset; |
| 78 | assert.equal(rows.length,1); |
| 79 | assert.equal(rows[0].Client_Reference,'CI-SYNTHETIC-ONLY'); |
| 80 | // SQL BIGINT is intentionally preserved as a decimal string |
| 81 | // by mssql to avoid loss of precision above Number.MAX_SAFE_INTEGER. |
| 82 | assert.equal(String(rows[0].Amount_IRR),'1250000'); |
| 83 | assert.match(String(rows[0].Amount_IRR),/^[0-9]+$/); |
| 84 | console.log('GATE_PASS_PATCHED_MSAL_MSSQL_DRIVER_REAL_VIEW_READ_INTEGER_IRR'); |
| 85 | for(const statement of [ |
| 86 | "UPDATE dbo.SyntheticTransfers SET Amount_IRR=1 WHERE Row_ID=1", |
| 87 | "DELETE FROM dbo.SyntheticTransfers WHERE Row_ID=1", |
| 88 | "SELECT * FROM dbo.SyntheticTransfers", |
| 89 | "DROP VIEW dbo.vw_ReadOnlyTransfers" |
| 90 | ])await assert.rejects(pool.request().query(statement)); |
| 91 | console.log('GATE_PASS_REAL_SQL2022_VIEW_ONLY_LOGIN_DENIES_WRITES_AND_BASE_TABLE'); |
| 92 | }finally{await pool.close()} |
| 93 | })().catch(e=>{console.log('SQL_DRIVER_SYNTHETIC_FAIL_'+String(e?.name||'UNKNOWN').replace(/[^A-Za-z]/g,''));process.exitCode=1}); |
| 94 | NODE |
| 95 | - name: Safe-only status |
| 96 | if: always() |
| 97 | shell: bash |
| 98 | run: echo NO_REAL_MAYAN_OR_BANK_NO_SECRETS_OR_PRIVATE_SOURCE_UPLOADED |