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

fix(security): encode untrusted financial UI content (ChequesView.js)

davoodmehraban89 committed Oct 31, 2026 at 00:22 UTC db4a9b36264dbc8ded89f3d5c5729024186f6d7a
1 file changed +9 -9
src/views/ChequesView.js
+9 -9
@@ -83,7 +83,7 @@ class ChequesViewImpl {
83 const isOverdue = diffDays < 0 && c.status === 'pending';
84 const isSoon = diffDays >= 0 && diffDays <= 7 && c.status === 'pending';
85
86 - let dueDisplay = Formatters.toPersianDigits(c.dueDate || '—');
86 + let dueDisplay = this._esc(Formatters.toPersianDigits(c.dueDate || '—'));
87 if (isOverdue) dueDisplay += ` <span class="badge badge-danger" style="font-size:9px">${Formatters.toPersianDigits(Math.abs(diffDays))} روز گذشته</span>`;
88 else if (isSoon) dueDisplay += ` <span class="badge badge-warning" style="font-size:9px">${Formatters.toPersianDigits(diffDays)} روز مانده</span>`;
89
@@ -95,11 +95,11 @@ class ChequesViewImpl {
95 </span>
96 </td>
97 <td><strong>${this._esc(c.contactName || '—')}</strong></td>
98 - <td style="font-family:monospace;font-size:11.5px">${Formatters.toPersianDigits(c.sayadNumber || '—')}</td>
98 + <td style="font-family:monospace;font-size:11.5px">${this._esc(Formatters.toPersianDigits(c.sayadNumber || '—'))}</td>
99 <td>${this._esc(c.bankName || '—')}</td>
100 <td style="font-weight:700">${Formatters.money(c.amount)}</td>
101 <td>${dueDisplay}</td>
102 - <td>${Formatters.toPersianDigits(c.issueDate || '—')}</td>
102 + <td>${this._esc(Formatters.toPersianDigits(c.issueDate || '—'))}</td>
103 <td>
104 <span class="badge ${ChequeController.getStatusClass(c.status)}">
105 ${ChequeController.getStatusLabel(c.status)}
@@ -107,9 +107,9 @@ class ChequesViewImpl {
107 </td>
108 <td>
109 <div class="row-actions">
110 - <button class="icon-btn-sm" title="تغییر وضعیت" onclick="window.ChequesView.changeStatus('${c.id}')">🔄</button>
111 - <button class="icon-btn-sm" title="ویرایش" onclick="window.ChequesView.editCheque('${c.id}')">✏️</button>
112 - <button class="icon-btn-sm danger" title="حذف" onclick="window.ChequesView.deleteCheque('${c.id}')">🗑️</button>
110 + <button class="icon-btn-sm" title="تغییر وضعیت" onclick="window.ChequesView.changeStatus(${this._esc(JSON.stringify(String(c.id ?? '')))})">🔄</button>
111 + <button class="icon-btn-sm" title="ویرایش" onclick="window.ChequesView.editCheque(${this._esc(JSON.stringify(String(c.id ?? '')))})">✏️</button>
112 + <button class="icon-btn-sm danger" title="حذف" onclick="window.ChequesView.deleteCheque(${this._esc(JSON.stringify(String(c.id ?? '')))})">🗑️</button>
113 </div>
114 </td>
115 </tr>
@@ -191,7 +191,7 @@ class ChequesViewImpl {
191 };
192
193 const contactOptions = cache.contacts.map(c =>
194 - `<option value="${c.id}" ${d.contactId === c.id ? 'selected' : ''}>${this._esc(c.name)}</option>`
194 + `<option value="${this._esc(c.id)}" ${d.contactId === c.id ? 'selected' : ''}>${this._esc(c.name)}</option>`
195 ).join('');
196
197 const body = `
@@ -264,7 +264,7 @@ class ChequesViewImpl {
264
265 const footer = `
266 <button class="btn btn-secondary" onclick="FINORA.Modal.close()">انصراف</button>
267 - <button class="btn" onclick="window.ChequesView.saveCheque(${isEdit ? `'${chequeId}'` : 'null'})">💾 ذخیره</button>
267 + <button class="btn" onclick="window.ChequesView.saveCheque(${isEdit ? this._esc(JSON.stringify(String(chequeId ?? ''))) : 'null'})">💾 ذخیره</button>
268 `;
269
270 Modal.open({ title: isEdit ? 'ویرایش چک' : 'چک جدید', body, footer, size: 'md' });
@@ -373,7 +373,7 @@ class ChequesViewImpl {
373 `;
374 const footer = `
375 <button class="btn btn-secondary" onclick="FINORA.Modal.close()">انصراف</button>
376 - <button class="btn" onclick="window.ChequesView._applyStatusChange('${id}')">اعمال</button>
376 + <button class="btn" onclick="window.ChequesView._applyStatusChange(${this._esc(JSON.stringify(String(id ?? '')))})">اعمال</button>
377 `;
378 Modal.open({ title: 'تغییر وضعیت چک', body, footer, size: 'sm' });
379 this._onChequeStatusSelection();