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

fix(q01): avoid treating default all-categories option as malicious category

davoodmehraban89 committed Oct 31, 2026 at 06:46 UTC ff210b825e9a77e9ed25fc0228391c20248da4f8
1 file changed +12 -2
tests/windows-vm-ui-interaction-audit-browser.js
+12 -2
@@ -356,10 +356,20 @@
356 await expenseView.reload();
357 const scratch=document.createElement('div');
358 scratch.innerHTML=expenseView.renderContent();
359 + const categoryFilter=scratch.querySelector('select[aria-label="سرفصل سند"]');
360 + const matchingOptions=[...(categoryFilter?.options || [])]
361 + .filter(option=>option.value===hostileCategory);
362 + const actualLabels=matchingOptions.map(option=>option.textContent);
363 if(scratch.querySelector('img') || scratch.querySelector('script') ||
360 - scratch.querySelector('select[aria-label="سرفصل سند"] option')?.value!==hostileCategory ||
364 + matchingOptions.length!==1 || actualLabels[0]!==hostileCategory ||
365 !scratch.textContent.includes(hostileCell)) {
362 - throw Error('Untrusted expense list fields created executable markup or corrupted category value');
366 + throw Error('Untrusted expense list fields created executable markup or corrupted category value: ' +
367 + JSON.stringify({filterFound:!!categoryFilter,
368 + optionsCount:categoryFilter?.options?.length ?? -1,
369 + maliciousCategoryPresent:matchingOptions.length===1,
370 + labelMatches:actualLabels[0]===hostileCategory,
371 + unexpectedImages:scratch.querySelectorAll('img').length,
372 + unexpectedScripts:scratch.querySelectorAll('script').length}));
373 }
374 expenseView.editExpense=(id)=>{clickedExpenseId=id;};
375 const edit=scratch.querySelector('button[title="ویرایش"]');