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

test(security): guard expense template escaping in static QA

davoodmehraban89 committed Oct 31, 2026 at 00:20 UTC 40d9cb44ba432b8dbdf4d371bba09c64b7070f3a
1 file changed +15
tests/ui-control-structure.test.mjs
+15
@@ -132,6 +132,21 @@ test('Q01: primary search and filter controls have explicit accessible names', (
132 }
133 });
134
135 +test('A03: expense table escapes imported values in HTML and inline action arguments', () => {
136 + const src=fs.readFileSync(path.join(root,'src','views','ExpensesView.js'),'utf8');
137 + const native=fs.readFileSync(path.join(root,'tests','windows-vm-ui-interaction-audit-browser.js'),'utf8');
138 + for(const fragment of [
139 + 'this._esc(Formatters.toPersianDigits(e.date',
140 + 'this._esc(ExpenseController.getMethodLabel(e.method))',
141 + 'this._esc(e.refNumber ? Formatters.toPersianDigits(e.refNumber)',
142 + 'this._esc(JSON.stringify(String(e.id ??',
143 + '<option value="${this._esc(c)}"'
144 + ]) assert.ok(src.includes(fragment), 'unescaped expense HTML found: '+fragment);
145 + assert.ok(native.includes('expenseUnsafeHtmlEscaped:true'));
146 + assert.ok(native.includes('Untrusted expense list fields created executable markup'));
147 + assert.ok(native.includes('Expense row identifier escaped the safe JS argument'));
148 +});
149 +
150 test('Q01: Escape is handled once for nested financial dialogs and shortcut target is topmost', () => {
151 const shortcuts = fs.readFileSync(path.join(root,'src','core','KeyboardShortcuts.js'),'utf8');
152 const modal = fs.readFileSync(path.join(root,'src','core','Modal.js'),'utf8');