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

security(a02): reject non-full, nonfirst or damaged SQL backup sets before VERIFYONLY

davoodmehraban89 committed Oct 30, 2026 at 17:23 UTC a8cca6e880b0899af17d302faf258abca39a8cb1
1 file changed +12
scripts/a02-sql-backup-readonly-preflight.ps1
+12
@@ -168,6 +168,18 @@ try {
168 # Multiple backup sets need explicit FILE number/version handling.
169 throw 'BACKUP_SET_COUNT_UNSUPPORTED'
170 }
171 + # A02 only supports a single full-database backup set at position 1.
172 + # Do not mistake a log, differential or partial backup for a restorable
173 + # standalone database image.
174 + if ([int]$header.Rows[0]['BackupType'] -ne 1 -or
175 + [int]$header.Rows[0]['Position'] -ne 1) {
176 + throw 'BACKUP_NOT_STANDALONE_FULL_DATABASE'
177 + }
178 + if ($header.Columns.Contains('IsDamaged') -and
179 + $header.Rows[0]['IsDamaged'] -ne [System.DBNull]::Value -and
180 + [bool]$header.Rows[0]['IsDamaged']) {
181 + throw 'BACKUP_HEADER_REPORTS_DAMAGED'
182 + }
183 $sourceMajor = [int]$header.Rows[0]['SoftwareVersionMajor']
184 if ($sourceMajor -lt 9 -or $sourceMajor -gt $serverMajor) {
185 throw 'SQL_BACKUP_VERSION_INCOMPATIBLE'