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

fix(A04): validate source company for each backup record

davoodmehraban89 committed Oct 19, 2026 at 16:53 UTC 3a059b98c31a032a6725e07cb15999dce6461c2d
1 file changed +12
src/controllers/SettingsController.js
+12
@@ -180,6 +180,18 @@ class SettingsControllerImpl {
180 }
181 }
182
183 + for (const store of COMPANY_BACKUP_STORES) {
184 + const rows = backup.data[store];
185 + if (rows === undefined) continue;
186 + if (!Array.isArray(rows)) throw new Error(`جدول ${store} در فایل پشتیبان نامعتبر است`);
187 + for (const row of rows) {
188 + if (!row || typeof row !== 'object' || Array.isArray(row) ||
189 + row.companyId !== backup.companyId) {
190 + throw new Error('فایل پشتیبان حاوی رکورد متعلق به شرکت دیگری است');
191 + }
192 + }
193 + }
194 +
195 const companyId = await DataScope.companyId();
196 // Prevent an accidental merge of one company's books into another.
197 // Explicit cross-company migration is a separate, intentional operation.