fix(security): address critical and high findings from security audit
Fix stored XSS in tasks (titles/subtasks) and settings (member list) by applying escHtml(). Harden trust proxy to loopback default, add OAuth state parameter for Google Calendar CSRF protection, sanitize CSV export against formula injection, invalidate sessions on user deletion, restrict usernames to alphanumeric chars, and require admin role for calendar sync triggers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -147,14 +147,19 @@ router.get('/export', (req, res) => {
|
||||
`).all(from, to);
|
||||
|
||||
const header = 'Datum,Titel,Betrag,Kategorie,Wiederkehrend,Erstellt von\n';
|
||||
const csvSafe = (val) => {
|
||||
let s = String(val || '').replace(/"/g, '""');
|
||||
if (/^[=+\-@\t\r]/.test(s)) s = "'" + s;
|
||||
return `"${s}"`;
|
||||
};
|
||||
const rows = entries.map((e) =>
|
||||
[
|
||||
e.date,
|
||||
`"${(e.title || '').replace(/"/g, '""')}"`,
|
||||
csvSafe(e.title),
|
||||
e.amount.toFixed(2).replace('.', ','),
|
||||
e.category,
|
||||
e.is_recurring ? 'Ja' : 'Nein',
|
||||
`"${(e.creator_name || '').replace(/"/g, '""')}"`,
|
||||
csvSafe(e.creator_name),
|
||||
].join(',')
|
||||
).join('\n');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user