security: fix all Critical and High findings from FLAWS_REPORT audit
- Auth: pessimistic locking on login tokens and refresh token rotation, backup code attempt counter, rate limiting verification - Schema: unique constraints on business numbers, FK relations, unsigned/signed alignment, attendance duplicate prevention - Invoices/PDFs: DOMPurify sanitization, bounded queries in stats and alerts, VAT rounding, Puppeteer error handling - Orders/Offers: transactional parent+child creation, Zod NaN refinement, status enums, uniqueness checks - Projects/Files: path traversal protection, streamed uploads, permission guards, query param validation - Attendance/HR: duplicate checks, ownership validation, GPS restrictions, trip distance validation - Frontend: modal lock reference counting, XSS escaping in print HTML, ref mutation fixes, accessibility attributes Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -48,11 +48,15 @@ export async function checkInvoiceAlerts(): Promise<void> {
|
||||
const createdInvoices = await prisma.invoices.findMany({
|
||||
where: {
|
||||
status: { in: ["issued", "overdue"] },
|
||||
due_date: { not: null },
|
||||
due_date: { gte: today, lte: in3days },
|
||||
},
|
||||
include: {
|
||||
select: {
|
||||
id: true,
|
||||
invoice_number: true,
|
||||
due_date: true,
|
||||
currency: true,
|
||||
customers: { select: { name: true } },
|
||||
invoice_items: true,
|
||||
invoice_items: { select: { quantity: true, unit_price: true } },
|
||||
},
|
||||
});
|
||||
|
||||
@@ -105,7 +109,15 @@ export async function checkInvoiceAlerts(): Promise<void> {
|
||||
const receivedInvoices = await prisma.received_invoices.findMany({
|
||||
where: {
|
||||
status: "unpaid",
|
||||
due_date: { not: null },
|
||||
due_date: { gte: today, lte: in3days },
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
invoice_number: true,
|
||||
supplier_name: true,
|
||||
amount: true,
|
||||
currency: true,
|
||||
due_date: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user