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

test(a02): refuse destructive Excel imports in installed Windows WebView2

davoodmehraban89 committed Oct 31, 2026 at 00:36 UTC 458968ad42ecac5a0330c7e562af8876d24939b8
1 file changed +20
tests/windows-vm-ui-interaction-audit-browser.js
+20
@@ -408,7 +408,27 @@
408 delete window.Q01_INVOICE_ID_ATTACK;
409 delete window.Q01_INVOICE_HTML_ATTACK;
410 }
411 + // Fail-closed Excel replacement attempts must not delete financial master
412 + // records even when callers bypass the UI. Synthetic workbook only.
413 + const beforeProducts=JSON.stringify(await FINORA.Storage.getAll('products'));
414 + const beforeContacts=JSON.stringify(await FINORA.Storage.getAll('contacts'));
415 + for (const mode of ['replace','wipe','unknown']) {
416 + for (const [method, sheet, row] of [
417 + ['importProducts','کالاها',{'نام':'Q01 non-destructive product'}],
418 + ['importContacts','اشخاص',{'نام':'Q01 non-destructive contact'}]
419 + ]) {
420 + let rejected=false;
421 + try { await window.ExcelController[method]({[sheet]:[row]},{mode}); }
422 + catch(error) { rejected=String(error?.message||'').includes('جایگزینی گروهی'); }
423 + if (!rejected) throw Error('Excel '+method+' accepted unsafe mode: '+mode);
424 + }
425 + }
426 + if (JSON.stringify(await FINORA.Storage.getAll('products'))!==beforeProducts ||
427 + JSON.stringify(await FINORA.Storage.getAll('contacts'))!==beforeContacts) {
428 + throw Error('An unsupported Excel mode mutated existing customer or product data');
429 + }
430 const modalKeyboard={roleAndLabel:true,nestedDialogIsolation:true,
431 + excelReplacementRejectedWithoutWrites:true,
432 importedInvoiceHtmlEscaped:true,
433 expenseUnsafeHtmlEscaped:true,
434 modalFormLabelsLinked:true,