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

fix(backup): require recognized app identity for restore

* fix(backup): require known application identity on restore * test(backup): reject backups without a known application identity

davoodmehraban89 committed Oct 14, 2026 at 22:19 UTC d8f2537d0a4806f60295bcd3969aa18a1f7dd591
2 files changed +10 -1
src/core/StorageService.js
+1 -1
@@ -294,7 +294,7 @@ class StorageServiceImpl {
294 !json.data || typeof json.data !== 'object' || Array.isArray(json.data)) {
295 throw new Error('فرمت فایل نامعتبر است');
296 }
297 - if (json.app && !['Finora Pro', 'Factor-easyPro'].includes(json.app)) {
297 + if (!['Finora Pro', 'Factor-easyPro'].includes(json.app)) {
298 throw new Error('این فایل پشتیبان فینورا پرو نیست');
299 }
300 if (!Number.isSafeInteger(json.version) || json.version < 1) {
tests/backup-version-validation.test.mjs
+9
@@ -21,3 +21,12 @@ test('backup import rejects an unrelated application before database access', as
21 test('backup import rejects array-shaped payloads', async () => {
22 await assert.rejects(StorageService.importAll({ app: 'Factor-easyPro', version: 6, data: [] }), /فرمت فایل نامعتبر/);
23 });
24 +
25 +test('backup import requires a recognized application identity', async () => {
26 + for (const app of [undefined, null, '', 'other']) {
27 + await assert.rejects(
28 + StorageService.importAll({ app, version: 6, data: {} }),
29 + /فینورا پرو/
30 + );
31 + }
32 +});