فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

ci(a08): reject foreign artifact runs and verify native workflow provenance

Davood Mehraban committed Nov 23, 2026 at 22:12 UTC 97dc04f7c85c079f46a1c867076559ed7784794b
1 file changed +6 -3
.github/workflows/a08-targeted-native-reuse.yml
+6 -3
@@ -44,10 +44,13 @@ jobs:
44 if ((git rev-parse HEAD).Trim() -ne $env:SOURCE_SHA) { throw 'Checked out source SHA mismatch' }
45 if ($env:EXPECTED_VERSION -notmatch '^\d+\.\d+\.\d+$') { throw 'Invalid candidate version' }
46 $run=gh api "repos/$env:GITHUB_REPOSITORY/actions/runs/$env:SOURCE_RUN" | ConvertFrom-Json
47 - if ($run.head_sha -ne $env:SOURCE_SHA -or $run.status -ne 'completed' -or
47 + # Reject artifacts produced by a fork or by an unrelated workflow.
48 + $repo=gh api "repos/$env:GITHUB_REPOSITORY" | ConvertFrom-Json
49 + if ($run.repository.id -ne $repo.id -or $run.head_repository.id -ne $repo.id -or
50 + $run.head_sha -ne $env:SOURCE_SHA -or $run.status -ne 'completed' -or
51 $run.conclusion -ne 'success' -or $run.event -notin @('pull_request','push','workflow_dispatch') -or
49 - $run.path -notmatch 'windows-vm-native-lab.yml') {
50 - throw 'Source must be a completed native lab run on exactly this commit'
52 + $run.path -notmatch '(^|/)windows-vm-native-lab[.]yml(@|$)') {
53 + throw 'Source must be a successful first-party native lab run on exactly this commit'
54 }
55 Write-Host ("Verified candidate run "+$run.html_url+" SHA "+$run.head_sha)
56 - name: Reuse already-built candidate NSIS