فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(security): encode untrusted financial UI content (ui-control-structure.test.mjs)
davoodmehraban89 committed
Oct 31, 2026 at 00:22 UTC
12434a41bba7c1cd1de33563d7ae1193c2e564fd
1 file changed
+15
tests/ui-control-structure.test.mjs
+15
@@ -147,6 +147,21 @@ test('A03: expense table escapes imported values in HTML and inline action argum
147
assert.ok(native.includes('Expense row identifier escaped the safe JS argument'));
148
});
149
150
+test('A03: financial list views encode imported record IDs and textual values', () => {
151
+ const sources=['InvoicesView','ProductsView','ContactsView','TreasuryView','ChequesView'];
152
+ for(const name of sources){
153
+ const source=fs.readFileSync(path.join(root,'src','views',name+'.js'),'utf8');
154
+ assert.ok(source.includes('this._esc(JSON.stringify(String('),
155
+ name+' lacks HTML-safe JSON encoding for inline record arguments');
156
+ assert.doesNotMatch(source,/onclick="[^"]*\('\$\{[^}]+\.id\}'\)/,
157
+ name+' still interpolates raw IDs into JavaScript event handlers');
158
+ assert.doesNotMatch(source,/<option value="\$\{(?:[a-zA-Z]+)\.id\}"/,
159
+ name+' still interpolates raw IDs into option attributes');
160
+ }
161
+ const expenses=fs.readFileSync(path.join(root,'src','views','ExpensesView.js'),'utf8');
162
+ assert.ok(expenses.includes('this._esc(JSON.stringify(String(e.id ??')));
163
+});
164
+
165
test('Q01: Escape is handled once for nested financial dialogs and shortcut target is topmost', () => {
166
const shortcuts = fs.readFileSync(path.join(root,'src','core','KeyboardShortcuts.js'),'utf8');
167
const modal = fs.readFileSync(path.join(root,'src','core','Modal.js'),'utf8');