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

Prepare guarded Windows V6 public runner bridge with private scoped asset download and sanitized logs

davoodmehraban89 committed Oct 17, 2026 at 12:01 UTC a10de3a4740d2fb624c7ae5792a473f3f79c8f7f
1 file changed +137
.github/workflows/windows-v6-private-inputs-public-runner.yml new
+137
@@ -0,0 +1,137 @@
1 +name: V6 private inputs on free public Windows runner (NOT V7)
2 +on:
3 + workflow_dispatch:
4 +
5 +permissions:
6 + contents: read
7 +
8 +concurrency:
9 + group: treasuryflow-public-windows-v6-validation
10 + cancel-in-progress: false
11 +
12 +jobs:
13 + validate-v6:
14 + name: Windows 2022 — private V6 inputs, sanitized evidence only
15 + runs-on: windows-2022
16 + timeout-minutes: 75
17 + env:
18 + BANK_ADAPTER_MODE: disabled
19 + TREASURYFLOW_ENABLE_MAYAN_EXTERNAL_READ: '0'
20 + TREASURYFLOW_MAYAN_ENABLE_EXTERNAL_READ: '0'
21 + TREASURYFLOW_ENABLE_SQL_LAB: '0'
22 + TREASURYFLOW_DESKTOP_LOCAL: '1'
23 + TF_PRIVATE_TAG: validation-inputs-20261017
24 + defaults:
25 + run:
26 + shell: pwsh
27 + steps:
28 + - name: Verify private release inputs with scoped read-only token
29 + env:
30 + GH_TOKEN: ${{ secrets.TF_VALIDATION_READ_TOKEN }}
31 + run: |
32 + $ErrorActionPreference='Stop'
33 + if ([string]::IsNullOrWhiteSpace($env:GH_TOKEN)) { throw 'PRIVATE_READ_TOKEN_NOT_CONFIGURED' }
34 + $inputDir=Join-Path $env:RUNNER_TEMP 'tf-private-inputs'
35 + $sourceDir=Join-Path $env:RUNNER_TEMP 'tf-v6-stage'
36 + $exeDir=Join-Path $env:RUNNER_TEMP 'tf-v6-portable'
37 + New-Item -ItemType Directory -Force -Path $inputDir,$sourceDir,$exeDir | Out-Null
38 + gh release download $env:TF_PRIVATE_TAG --repo 'davoodmehraban89/TreasuryFlow-Validation-Private' --pattern 'TreasuryFlow_Validation_Staging_20261017.zip' --pattern 'release-native-v6-final.rar' --dir $inputDir 1>$null 2>$null
39 + if ($LASTEXITCODE -ne 0) { throw 'PRIVATE_RELEASE_DOWNLOAD_FAILED' }
40 + $inputs=@(
41 + @{name='TreasuryFlow_Validation_Staging_20261017.zip';sha='9ce46ce2d2a437e08cbf28146b2cf2ac0ed078c71f1aeb537764390cdd3c552f'},
42 + @{name='release-native-v6-final.rar';sha='b8629defc172cef972ad12bb3a2e45a55abed3a5e3a5d991ab2567b877e0c915'}
43 + )
44 + foreach($f in $inputs) {
45 + $file=Join-Path $inputDir $f.name
46 + if (!(Test-Path -LiteralPath $file)) { throw 'PRIVATE_INPUT_MISSING' }
47 + $sha=(Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash
48 + if ($sha -ine $f.sha) { throw 'PRIVATE_INPUT_SHA256_FAILED' }
49 + }
50 + Expand-Archive -LiteralPath (Join-Path $inputDir 'TreasuryFlow_Validation_Staging_20261017.zip') -DestinationPath $sourceDir -Force
51 + if(!(Test-Path -LiteralPath (Join-Path $sourceDir 'native/MayanInterop/Program.cs'))) { throw 'RECOVERED_NATIVE_SOURCE_MISSING' }
52 + $seven=(Get-Command 7z.exe -ErrorAction Stop).Source
53 + & $seven x -y "-o$exeDir" (Join-Path $inputDir 'release-native-v6-final.rar') *> (Join-Path $env:RUNNER_TEMP 'private-extract.log')
54 + if ($LASTEXITCODE -ne 0) { throw 'PRIVATE_RAR_EXTRACT_FAILED' }
55 + $exe=Get-ChildItem -LiteralPath $exeDir -Filter 'TreasuryFlow-1.0.1-Windows-x64.exe' -File -Recurse | Select-Object -First 1
56 + if(!$exe){throw 'V6_EXE_MISSING'}
57 + if((Get-FileHash -LiteralPath $exe.FullName -Algorithm SHA256).Hash -ine '99976331f606d8c8ffcf8e9f4895848ff736870790e14b4c7f08a0abdbb7a50a'){throw 'V6_EXE_SHA256_FAILED'}
58 + "TF_PRIVATE_SOURCE_DIR=$sourceDir" >> $env:GITHUB_ENV
59 + "TF_PRIVATE_V6_EXE=$($exe.FullName)" >> $env:GITHUB_ENV
60 + "TF_PRIVATE_ASSET_SHA_PASS=true" >> $env:GITHUB_ENV
61 + Write-Host 'PRIVATE_INPUT_TRANSFER_AND_HASH_PASS (source and binaries will never be uploaded as public artifacts)'
62 +
63 + - name: Install Node 22 after private download token is removed
64 + uses: actions/setup-node@v4
65 + with:
66 + node-version: '22'
67 +
68 + - name: Run source test and build gates without printing proprietary output
69 + run: |
70 + $ErrorActionPreference='Stop'
71 + if ($env:TF_PRIVATE_ASSET_SHA_PASS -ne 'true') { throw 'PRIVATE_INPUTS_NOT_VERIFIED' }
72 + Set-Location -LiteralPath $env:TF_PRIVATE_SOURCE_DIR
73 + function Gate([string]$name,[scriptblock]$action){
74 + $log=Join-Path $env:RUNNER_TEMP ("private-gate-"+$name+".log")
75 + $global:LASTEXITCODE=0
76 + try {
77 + & $action *> $log
78 + if($LASTEXITCODE -ne 0){throw 'NONZERO_EXIT'}
79 + Write-Host "GATE_PASS: $name"
80 + } catch {
81 + throw "GATE_FAIL: $name (full private log intentionally withheld from PUBLIC repository)"
82 + }
83 + }
84 + Gate 'npm-ci' { npm ci --no-audit --no-fund }
85 + Gate 'readonly-sql-guard' { node --test src/platform/integration/readonly-sql-policy.node.mjs }
86 + Gate 'copyable-sql-widget' { node scripts/check-sql-copy-ui.mjs }
87 + Gate 'typecheck' { npm run typecheck }
88 + Gate 'unit-tests' { npm test -- --reporter=dot }
89 + Gate 'lint' { npm run lint }
90 + Gate 'next-build' { npm run build }
91 + Gate 'standalone-bundle' { node scripts/prepare-standalone.mjs }
92 + $env:NODE_PATH=Join-Path $env:TF_PRIVATE_SOURCE_DIR '.next/standalone/vendor_modules'
93 + Gate 'standalone-smoke' { npm run smoke }
94 + "TF_SOURCE_GATES_PASS=true" >> $env:GITHUB_ENV
95 +
96 + - name: Compile and self-check recovered C-sharp bridge
97 + run: |
98 + $ErrorActionPreference='Stop'
99 + if($env:TF_SOURCE_GATES_PASS -ne 'true'){throw 'SOURCE_GATES_NOT_PASSED'}
100 + Set-Location -LiteralPath $env:TF_PRIVATE_SOURCE_DIR
101 + & ./scripts/build-mayan-native.ps1 *> (Join-Path $env:RUNNER_TEMP 'private-native-compile.log')
102 + if ($LASTEXITCODE -ne 0){throw 'NATIVE_BUILD_FAILED'}
103 + $exe=Join-Path $env:TF_PRIVATE_SOURCE_DIR 'native/MayanInterop/TreasuryFlow.MayanInterop.exe'
104 + if(!(Test-Path -LiteralPath $exe)){throw 'NATIVE_OUTPUT_MISSING'}
105 + $hash=(Get-FileHash -LiteralPath $exe -Algorithm SHA256).Hash
106 + $result=(& $exe 'verify-assembly' $exe $hash | ConvertFrom-Json)
107 + if($LASTEXITCODE -ne 0 -or !$result.ok -or $result.loadedForExecution -ne $false){throw 'NATIVE_SELF_CHECK_FAILED'}
108 + Write-Host 'GATE_PASS: native-compile-and-self-check'
109 + "TF_NATIVE_PASS=true" >> $env:GITHUB_ENV
110 +
111 + - name: Run SHA256 pinned original V6 portable on Windows
112 + run: |
113 + $ErrorActionPreference='Stop'
114 + if($env:TF_NATIVE_PASS -ne 'true'){throw 'NATIVE_NOT_VALIDATED'}
115 + Set-Location -LiteralPath $env:TF_PRIVATE_SOURCE_DIR
116 + & ./qa/windows/portable-v6-smoke.ps1 -Executable $env:TF_PRIVATE_V6_EXE -ExpectedSha256 '99976331f606d8c8ffcf8e9f4895848ff736870790e14b4c7f08a0abdbb7a50a' -EvidenceDir $env:RUNNER_TEMP *> (Join-Path $env:RUNNER_TEMP 'private-v6-runtime.log')
117 + if($LASTEXITCODE -ne 0){throw 'V6_PORTABLE_READINESS_FAILED'}
118 + $result=Get-Content -Raw -LiteralPath (Join-Path $env:RUNNER_TEMP 'v6-portable-runtime.json') | ConvertFrom-Json
119 + if($result.status -ne 'PASS_READY_ONLY' -or !$result.ready -or !$result.bankDisabled){throw 'V6_READINESS_CONTRACT_FAILED'}
120 + "TF_V6_PORTABLE_PASS=true" >> $env:GITHUB_ENV
121 + Write-Host 'GATE_PASS: V6 portable process and local readiness (NOT full GUI/SQL Server)'
122 +
123 + - name: Publish only non-sensitive pass/fail gate summary
124 + if: always()
125 + run: |
126 + $report=[ordered]@{
127 + stage='PRELIMINARY_V6_PUBLIC_RUNNER'
128 + privateInputsHashValidated=($env:TF_PRIVATE_ASSET_SHA_PASS -eq 'true')
129 + sourceGatePassed=($env:TF_SOURCE_GATES_PASS -eq 'true')
130 + nativeGatePassed=($env:TF_NATIVE_PASS -eq 'true')
131 + portableReadinessPassed=($env:TF_V6_PORTABLE_PASS -eq 'true')
132 + sqlServerAcceptance='NOT_TESTED'
133 + v7Acceptance='NOT_TESTED'
134 + privateSourcePublished=$false
135 + productionBankConnections='DISABLED'
136 + }
137 + $report | ConvertTo-Json -Compress | Write-Host