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

fix(native-test): exercise invoice injection without unavailable global controller or database writes

davoodmehraban89 committed Oct 31, 2026 at 00:25 UTC 2966e46083d2b64c650f21bd06a4525561a5ed8a
1 file changed +2 -7
tests/windows-vm-ui-interaction-audit-browser.js
+2 -7
@@ -380,20 +380,17 @@
380 }
381 // Read-only adversarial invoice render: unknown imported kinds, invoice IDs,
382 // number and date must never create active markup or execute row handlers.
383 - const invoiceController=window.InvoiceController;
383 const invoiceView=window.InvoicesView;
385 - const originalInvoices=invoiceController.getAll;
384 const originalEditInvoice=invoiceView.editInvoice;
385 const hostileInvoiceId="inv-test');window.Q01_INVOICE_ID_ATTACK=true;//";
386 const injectedKind='<img src=x onerror="window.Q01_INVOICE_HTML_ATTACK=true">';
387 let editedInvoiceId=null;
388 try {
391 - invoiceController.getAll=async()=>[{id:hostileInvoiceId,number:injectedKind,
389 + const syntheticInvoices=[{id:hostileInvoiceId,number:injectedKind,
390 kind:injectedKind,contactName:injectedKind,date:injectedKind,
391 grandTotal:100,paidAmount:0,remaining:100,status:'unpaid',isPreInvoice:false}];
394 - await invoiceView.reload();
392 const frag=document.createElement('div');
396 - frag.innerHTML=invoiceView.renderTable();
393 + frag.innerHTML=invoiceView.renderTable(syntheticInvoices);
394 if(frag.querySelector('img') || frag.querySelector('script') ||
395 !frag.textContent.includes(injectedKind)) {
396 throw Error('Imported invoice kind or date escaped the safe HTML rendering boundary');
@@ -407,9 +404,7 @@
404 throw Error('Imported invoice identifier executed unsafe inline action code');
405 }
406 } finally {
410 - invoiceController.getAll=originalInvoices;
407 invoiceView.editInvoice=originalEditInvoice;
412 - await invoiceView.reload();
408 delete window.Q01_INVOICE_ID_ATTACK;
409 delete window.Q01_INVOICE_HTML_ATTACK;
410 }