security: CAPA privilege escalation, CSV injection, AI rate-limit, prompt injection guard, open redirect, timing-safe cron secret, server-only admin client, notifications RLS
This commit is contained in:
+3
-1
@@ -1,6 +1,8 @@
|
||||
export function escapeCsv(value: string | number | null | undefined): string {
|
||||
if (value === null || value === undefined) return ''
|
||||
const str = String(value)
|
||||
let str = String(value)
|
||||
// Prevent CSV formula injection (Excel/LibreOffice execute cells starting with these chars)
|
||||
if (/^[=+\-@\t\r]/.test(str)) str = "'" + str
|
||||
if (str.includes(',') || str.includes('"') || str.includes('\n')) {
|
||||
return `"${str.replace(/"/g, '""')}"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user