22 lines
874 B
TypeScript
22 lines
874 B
TypeScript
/**
|
|
* Fire-and-forget security audit helpers (access denials, auth failures).
|
|
*/
|
|
import { Request } from 'express';
|
|
import { AuthRequest } from '../middleware/auth';
|
|
export declare function auditContextFromRequest(req: Request | AuthRequest): {
|
|
ipAddress?: string;
|
|
userAgent?: string;
|
|
userId?: string;
|
|
};
|
|
/** Records a security-relevant audit event without blocking the caller. */
|
|
export declare function logSecurityEvent(action: string, ctx: {
|
|
userId?: string | null;
|
|
ipAddress?: string | null;
|
|
userAgent?: string | null;
|
|
resourceType?: string | null;
|
|
resourceId?: string | null;
|
|
metadata?: Record<string, unknown> | null;
|
|
}): void;
|
|
/** Logs HTTP 403 / permission denial. */
|
|
export declare function logAccessDenied(req: AuthRequest, reason: string, metadata?: Record<string, unknown>): void;
|
|
//# sourceMappingURL=securityAudit.d.ts.map
|