generated from nhcarrigan/template
feat: security and auditing
This commit is contained in:
@@ -10,4 +10,5 @@ export * from "./lib/art.types";
|
||||
export * from "./lib/show.types";
|
||||
export * from "./lib/manga.types";
|
||||
export type * from "./lib/auth.types";
|
||||
export * from "./lib/comment.types";
|
||||
export * from "./lib/comment.types";
|
||||
export * from "./lib/audit.types";
|
||||
@@ -0,0 +1,47 @@
|
||||
export enum AuditAction {
|
||||
LOGIN = "LOGIN",
|
||||
LOGOUT = "LOGOUT",
|
||||
LOGIN_FAILED = "LOGIN_FAILED",
|
||||
COMMENT_CREATE = "COMMENT_CREATE",
|
||||
COMMENT_DELETE = "COMMENT_DELETE",
|
||||
ENTRY_CREATE = "ENTRY_CREATE",
|
||||
ENTRY_UPDATE = "ENTRY_UPDATE",
|
||||
ENTRY_DELETE = "ENTRY_DELETE",
|
||||
USER_BAN = "USER_BAN",
|
||||
USER_UNBAN = "USER_UNBAN",
|
||||
RATE_LIMIT_EXCEEDED = "RATE_LIMIT_EXCEEDED",
|
||||
CSRF_VALIDATION_FAILED = "CSRF_VALIDATION_FAILED",
|
||||
UNAUTHORIZED_ACCESS = "UNAUTHORIZED_ACCESS",
|
||||
}
|
||||
|
||||
export enum AuditCategory {
|
||||
AUTH = "AUTH",
|
||||
CONTENT = "CONTENT",
|
||||
ADMIN = "ADMIN",
|
||||
SECURITY = "SECURITY",
|
||||
}
|
||||
|
||||
export interface AuditLog {
|
||||
id: string;
|
||||
action: AuditAction;
|
||||
category: AuditCategory;
|
||||
userId?: string;
|
||||
targetUserId?: string;
|
||||
resourceType?: string;
|
||||
resourceId?: string;
|
||||
details?: string;
|
||||
userAgent?: string;
|
||||
success: boolean;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export interface AuditLogFilters {
|
||||
action?: AuditAction;
|
||||
category?: AuditCategory;
|
||||
userId?: string;
|
||||
success?: boolean;
|
||||
startDate?: Date;
|
||||
endDate?: Date;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}
|
||||
@@ -11,6 +11,7 @@ export interface User {
|
||||
avatarUrl?: string;
|
||||
discordId: string;
|
||||
isAdmin: boolean;
|
||||
isBanned: boolean;
|
||||
}
|
||||
|
||||
export interface JwtPayload {
|
||||
|
||||
Reference in New Issue
Block a user