fix: code review — XSS, type safety, validation improvements
Critical: - InvoiceDetail: sanitize notes HTML with DOMPurify - OrderDetail: use proper DOMPurify import instead of window fallback Important: - AttendanceBalances: add fund_to_date to interface, remove as-any casts - All schemas: replace z.any() with z.preprocess for boolean fields - Routes: simplify boolean coercion (Zod handles it now) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -177,9 +177,7 @@ export default async function tripsRoutes(
|
||||
route_from: String(body.route_from),
|
||||
route_to: String(body.route_to),
|
||||
is_business:
|
||||
body.is_business === true ||
|
||||
body.is_business === 1 ||
|
||||
body.is_business === "1",
|
||||
!!body.is_business,
|
||||
notes: body.notes ? String(body.notes) : null,
|
||||
},
|
||||
});
|
||||
@@ -231,9 +229,7 @@ export default async function tripsRoutes(
|
||||
if (body.route_to !== undefined) data.route_to = String(body.route_to);
|
||||
if (body.is_business !== undefined)
|
||||
data.is_business =
|
||||
body.is_business === true ||
|
||||
body.is_business === 1 ||
|
||||
body.is_business === "1";
|
||||
!!body.is_business;
|
||||
if (body.notes !== undefined)
|
||||
data.notes = body.notes ? String(body.notes) : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user