فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(security): verify malicious contact ledger references do not create HTML
davoodmehraban89 committed
Oct 31, 2026 at 00:38 UTC
ca0a1374092525d230625e94b5364c3e3e2fc40e
1 file changed
+16
tests/windows-vm-ui-interaction-audit-browser.js
+16
@@ -427,7 +427,23 @@
427
JSON.stringify(await FINORA.Storage.getAll('contacts'))!==beforeContacts) {
428
throw Error('An unsupported Excel mode mutated existing customer or product data');
429
}
430
+ // A read-only malicious ledger fixture must render all references as text.
431
+ const hostileLedgerText='<img src=x onerror="window.Q01_LEDGER_INJECTION=true">';
432
+ const syntheticLedger={finalBalance:0,totalDebit:0,totalCredit:0,
433
+ rows:[{date:hostileLedgerText,refNumber:hostileLedgerText,
434
+ type:'invoice_sale',typeLabel:hostileLedgerText,
435
+ isCheque:false,debit:0,credit:0,balance:0,note:hostileLedgerText}]};
436
+ const syntheticContact={name:hostileLedgerText,nationalId:hostileLedgerText,
437
+ entityType:'natural',role:'customer',tags:[]};
438
+ const ledgerScratch=document.createElement('div');
439
+ ledgerScratch.innerHTML=window.ContactLedgerModal._buildBody(syntheticContact,syntheticLedger);
440
+ if(ledgerScratch.querySelector('img') || window.Q01_LEDGER_INJECTION ||
441
+ !ledgerScratch.textContent.includes(hostileLedgerText)) {
442
+ throw Error('Financial contact ledger interpreted imported text as executable markup');
443
+ }
444
+ delete window.Q01_LEDGER_INJECTION;
445
const modalKeyboard={roleAndLabel:true,nestedDialogIsolation:true,
446
+ financialLedgerContentEscaped:true,
447
excelReplacementRejectedWithoutWrites:true,
448
importedInvoiceHtmlEscaped:true,
449
expenseUnsafeHtmlEscaped:true,