fix: add caching for defaultUA db call and code fixes

This commit is contained in:
mannilakash committed 2026-04-01 17:27:29 -04:00
1 parent babe5ae177
commit 023cf5782d
13 files changed
+89 -19

No files matched your search

+6
View File
@@ -21,6 +21,12 @@ export const booleanCoercion = z.preprocess((val) => {
return val; // Let Zod validation handle invalid values
}, z.boolean());
// RFC 7230: validate HTTP header field-value characters
export const httpHeaderValueSchema = z
.string()
.max(500)
.regex(/^[\t\x20-\x7E\x80-\xFF]*$/, "Must contain only valid HTTP header characters (RFC 7230)");
export const roleValidator = (allowedRoles: UserRole[]) => {
return z.array(z.custom<UserRole>()).refine((userRoles) => allowedRoles.some((role) => userRoles.includes(role)), {
message: `You do not have the required authorization. Required roles: ${allowedRoles.join(", ")}`,