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

1 name: V7 branch-only Next security refresh and production audit
2 on:
3 push:
4 paths:
5 - .github/workflows/v7-dependency-security-refresh-once.yml
6 workflow_dispatch:
7 permissions:
8 contents: write
9 jobs:
10 update-dependencies:
11 runs-on: ubuntu-22.04
12 timeout-minutes: 30
13 steps:
14 - uses: actions/checkout@v4
15 with:
16 persist-credentials: true
17 ref: dev/v7-production-failclosed-20261021
18 - uses: actions/setup-node@v4
19 with:
20 node-version: '22'
21 - name: Rebuild lockfile using pinned Next security version
22 shell: bash
23 run: |
24 set -euo pipefail
25 test "$GITHUB_REF_NAME" = 'dev/v7-production-failclosed-20261021'
26 node - <<'NODE'
27 const fs=require('node:fs');
28 const pkg=JSON.parse(fs.readFileSync('package.json','utf8'));
29 if(pkg.dependencies.next!=='16.3.8'||pkg.devDependencies['eslint-config-next']!=='16.3.8'){
30 throw Error('UNEXPECTED_NEXT_BASELINE_REFUSE');
31 }
32 NODE
33 npm ci --ignore-scripts --no-audit --no-fund >/tmp/tf-next-initial-npm.log 2>&1
34 npm install --save-exact --ignore-scripts --no-fund --no-audit next@16.4.1 >/tmp/tf-next-pinned.log 2>&1
35 npm install --save-dev --save-exact --ignore-scripts --no-fund --no-audit eslint-config-next@16.4.1 >/tmp/tf-eslint-pinned.log 2>&1
36 npm ci --ignore-scripts --no-audit --no-fund >/tmp/tf-next-reproducible-npm.log 2>&1
37 node - <<'NODE'
38 const fs=require('node:fs'),p=JSON.parse(fs.readFileSync('package.json','utf8'));
39 if(p.dependencies.next!=='16.4.1'||p.devDependencies['eslint-config-next']!=='16.4.1')
40 throw Error('EXACT_NEXT_SECURITY_VERSIONS_NOT_APPLIED');
41 console.log('GATE_PASS_EXACT_NEXT_16_4_1_AND_ESLINT_COMPANION');
42 NODE
43 - name: Verify application, security and no additional lockfile changes
44 shell: bash
45 run: |
46 set -euo pipefail
47 npm audit --omit=dev --audit-level=low >/tmp/tf-next-audit.log 2>&1 || {
48 echo 'GATE_FAIL_PRODUCTION_SECURITY_ADVISORIES_PRESENT'
49 exit 1
50 }
51 echo 'GATE_PASS_PRODUCTION_NPM_AUDIT_ZERO'
52 npm run typecheck
53 npm test
54 npm run lint
55 npm run build
56 npm run smoke
57 echo 'GATE_PASS_V7_BRANCH_BUILD_TEST_LINT_SMOKE'
58 changed=$(git diff --name-only)
59 if [ "$changed" != "$(printf 'package-lock.json\npackage.json')" ]; then
60 echo 'GATE_FAIL_UNEXPECTED_CHANGED_FILES'
61 exit 1
62 fi
63 - name: Persist only reviewed package manifest and lock on V7 branch
64 shell: bash
65 run: |
66 set -euo pipefail
67 test "$(git branch --show-current)" = 'dev/v7-production-failclosed-20261021'
68 git config user.name 'treasuryflow-security-bot'
69 git config user.email 'security-bot@users.noreply.github.com'
70 git add -- package.json package-lock.json
71 git diff --cached --check
72 git commit -m 'fix(security): pin Next.js and ESLint configuration to 16.4.1 on isolated V7 branch'
73 git push origin HEAD:refs/heads/dev/v7-production-failclosed-20261021
74 echo 'GATE_PASS_V7_PUBLIC_FEATURE_BRANCH_DEPENDENCIES_UPDATED_ONLY'