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:
2025-07-11 21:50:53 +02:00
committed by Kaj Kowalski
parent 3e9e75e854
commit 1eea2cc3e4
121 changed files with 28687 additions and 4895 deletions

View File

@ -148,7 +148,7 @@ export class CSRFProtection {
}
// Get token from request
const requestToken = await this.getTokenFromRequest(request);
const requestToken = await CSRFProtection.getTokenFromRequest(request);
if (!requestToken) {
return {
valid: false,
@ -193,7 +193,9 @@ export class CSRFProtection {
/**
* Extract token from request (handles different content types)
*/
private static async getTokenFromRequest(request: NextRequest): Promise<string | null> {
private static async getTokenFromRequest(
request: NextRequest
): Promise<string | null> {
// Check header first
const headerToken = request.headers.get(CSRF_CONFIG.headerName);
if (headerToken) {
@ -207,7 +209,11 @@ export class CSRFProtection {
if (contentType?.includes("application/json")) {
const body = await request.clone().json();
return body.csrfToken || body.csrf_token || null;
} else if (contentType?.includes("multipart/form-data") || contentType?.includes("application/x-www-form-urlencoded")) {
}
if (
contentType?.includes("multipart/form-data") ||
contentType?.includes("application/x-www-form-urlencoded")
) {
const formData = await request.clone().formData();
return formData.get("csrf_token") as string | null;
}
@ -270,11 +276,13 @@ export const CSRFClient = {
/**
* Add CSRF token to object (for JSON requests)
*/
addTokenToObject<T extends Record<string, unknown>>(obj: T): T & { csrfToken: string } {
addTokenToObject<T extends Record<string, unknown>>(
obj: T
): T & { csrfToken: string } {
const token = this.getToken();
return {
...obj,
csrfToken: token || "",
};
},
};
};