Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
Add one-shot fail-closed MSAL 7.1.0+ lockfile remediation with full test gate and feature-branch-only commit
davoodmehraban89 committed
Oct 26, 2026 at 07:58 UTC
52895f7b5c46ccea0bb393fe55e20fc583ad2d0d
1 file changed
+69
.github/workflows/v7-azure-msal-advisory-remediation-once.yml
new
+69
@@ -0,0 +1,69 @@
1
+name: V7 fix transitive MSAL advisory on isolated branch
2
+on:
3
+ push:
4
+ paths:
5
+ - .github/workflows/v7-azure-msal-advisory-remediation-once.yml
6
+permissions:
7
+ contents: write
8
+jobs:
9
+ remediation:
10
+ runs-on: ubuntu-22.04
11
+ timeout-minutes: 30
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ with:
15
+ persist-credentials: true
16
+ fetch-depth: 1
17
+ - uses: actions/setup-node@v4
18
+ with:
19
+ node-version: '22'
20
+ - name: Re-resolve only lock file against current npm advisories
21
+ shell: bash
22
+ run: |
23
+ set -euo pipefail
24
+ test "$GITHUB_REF_NAME" = 'dev/v7-production-failclosed-20261021'
25
+ npm ci --ignore-scripts --no-audit --no-fund >/dev/null
26
+ npm audit fix --package-lock-only --no-fund > "$RUNNER_TEMP/npm-security-patch.log" 2>&1 || {
27
+ echo 'GATE_FAIL_LOCKFILE_SECURITY_PATCH'
28
+ exit 1
29
+ }
30
+ git diff --exit-code -- package.json
31
+ node - <<'NODE'
32
+ const lock=require('./package-lock.json');
33
+ const dependency=lock.packages?.['node_modules/@azure/msal-node'];
34
+ if(!dependency)throw Error('MSAL_LOCK_ENTRY_MISSING');
35
+ const v=dependency.version.split('.').map(Number);
36
+ if(v[0]<7||(v[0]===7&&v[1]<1))throw Error('MSAL_LOCK_VERSION_UNPATCHED');
37
+ console.log('GATE_PASS_PATCHED_MSAL_VERSION_AT_LEAST_7_1_0');
38
+ NODE
39
+ - name: Fresh install plus full core gates
40
+ shell: bash
41
+ run: |
42
+ set -euo pipefail
43
+ npm ci --ignore-scripts --no-audit --no-fund > "$RUNNER_TEMP/npm-ci.log" 2>&1
44
+ npm audit --omit=dev --audit-level=low > "$RUNNER_TEMP/npm-audit.log" 2>&1 || {
45
+ echo 'GATE_FAIL_PRODUCTION_ADVISORIES_REMAIN'
46
+ exit 1
47
+ }
48
+ npm run typecheck > "$RUNNER_TEMP/types.log" 2>&1
49
+ npm run lint > "$RUNNER_TEMP/lint.log" 2>&1
50
+ npm test -- --reporter=dot > "$RUNNER_TEMP/tests.log" 2>&1
51
+ npm run build > "$RUNNER_TEMP/build.log" 2>&1
52
+ npm run smoke > "$RUNNER_TEMP/smoke.log" 2>&1
53
+ echo 'GATE_PASS_MSal_ADVISORY_ZERO_PRODUCTION_AUDIT_FULL_FINANCE_BUILD_SMOKE'
54
+ - name: Commit only validated dependency lock repair to isolated branch
55
+ shell: bash
56
+ run: |
57
+ set -euo pipefail
58
+ test "$GITHUB_REF_NAME" = 'dev/v7-production-failclosed-20261021'
59
+ test -z "$(git status --porcelain --untracked-files=no | grep -v 'package-lock.json' || true)"
60
+ if git diff --quiet -- package-lock.json; then
61
+ echo 'GATE_PASS_LOCKFILE_ALREADY_SECURE'
62
+ else
63
+ git config user.name "TreasuryFlow CI security bot"
64
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
65
+ git add -- package-lock.json
66
+ git commit -m 'fix: resolve MSAL Node high-severity transitive advisory in lockfile'
67
+ git push origin HEAD:refs/heads/dev/v7-production-failclosed-20261021
68
+ echo 'GATE_PASS_VALIDATED_LOCKFILE_COMMITTED_ON_FEATURE_BRANCH'
69
+ fi