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

fix(A03): verify backup history in chain sequence order

davoodmehraban89 committed Oct 20, 2026 at 08:40 UTC 7a2815fa4136750d8143048e87e62e415356b866
1 file changed +2 -1
src/controllers/SettingsController.js
+2 -1
@@ -188,7 +188,8 @@ class SettingsControllerImpl {
188 const history = backup.data.audit_events || [];
189 if (!Array.isArray(history)) throw new Error('سوابق ممیزی پشتیبان نامعتبر است');
190 if (backup.auditAnchor !== undefined || history.some(row => row.eventHash !== undefined)) {
191 - const result = verifyChain(history, backup.auditAnchor ?? null);
191 + const ordered = [...history].sort((a,b) => (a.chainIndex ?? 0) - (b.chainIndex ?? 0));
192 + const result = verifyChain(ordered, backup.auditAnchor ?? null);
193 if (!result.valid) throw new Error('زنجیره ممیزی یا لنگر پشتیبان نامعتبر است');
194 }
195