mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 14:12:10 +01:00
refactor: fix biome linting issues and update project documentation
- Fix 36+ biome linting issues reducing errors/warnings from 227 to 191 - Replace explicit 'any' types with proper TypeScript interfaces - Fix React hooks dependencies and useCallback patterns - Resolve unused variables and parameter assignment issues - Improve accessibility with proper label associations - Add comprehensive API documentation for admin and security features - Update README.md with accurate PostgreSQL setup and current tech stack - Create complete documentation for audit logging, CSP monitoring, and batch processing - Fix outdated project information and missing developer workflows
This commit is contained in:
17
lib/trpc.ts
17
lib/trpc.ts
@ -13,9 +13,9 @@ import { getServerSession } from "next-auth/next";
|
||||
import superjson from "superjson";
|
||||
import type { z } from "zod";
|
||||
import { authOptions } from "./auth";
|
||||
import { CSRFProtection } from "./csrf";
|
||||
import { prisma } from "./prisma";
|
||||
import { validateInput } from "./validation";
|
||||
import { CSRFProtection } from "./csrf";
|
||||
|
||||
/**
|
||||
* Create context for tRPC requests
|
||||
@ -169,7 +169,7 @@ const enforceCSRFProtection = t.middleware(async ({ ctx, next }) => {
|
||||
method: request.method,
|
||||
headers: request.headers,
|
||||
body: request.body,
|
||||
}) as any;
|
||||
}) as unknown as NextRequest;
|
||||
|
||||
// Validate CSRF token
|
||||
const validation = await CSRFProtection.validateRequest(nextRequest);
|
||||
@ -198,7 +198,12 @@ export const rateLimitedProcedure = publicProcedure.use(
|
||||
/**
|
||||
* CSRF-protected procedures for state-changing operations
|
||||
*/
|
||||
export const csrfProtectedProcedure = publicProcedure.use(enforceCSRFProtection);
|
||||
export const csrfProtectedAuthProcedure = csrfProtectedProcedure.use(enforceUserIsAuthed);
|
||||
export const csrfProtectedCompanyProcedure = csrfProtectedProcedure.use(enforceCompanyAccess);
|
||||
export const csrfProtectedAdminProcedure = csrfProtectedProcedure.use(enforceAdminAccess);
|
||||
export const csrfProtectedProcedure = publicProcedure.use(
|
||||
enforceCSRFProtection
|
||||
);
|
||||
export const csrfProtectedAuthProcedure =
|
||||
csrfProtectedProcedure.use(enforceUserIsAuthed);
|
||||
export const csrfProtectedCompanyProcedure =
|
||||
csrfProtectedProcedure.use(enforceCompanyAccess);
|
||||
export const csrfProtectedAdminProcedure =
|
||||
csrfProtectedProcedure.use(enforceAdminAccess);
|
||||
|
||||
Reference in New Issue
Block a user