feat: Implement audit logging and rate limiting middleware with SurrealDB integration

- Added audit logging middleware to track admin actions and save logs to SurrealDB.
- Introduced rate limiting middleware for public endpoints and authentication endpoints.
- Enhanced security headers middleware with nonce generation for CSP in development.
- Created utility functions for extracting real client IP addresses from headers.
- Updated Cargo.toml and Cargo.lock to include new dependencies.
- Added new schemas for audit logs and rate limiting in the entities module.
- Refactored permissions middleware to support new permission checks.
This commit is contained in:
MythEclipse
2025-10-12 01:54:34 +07:00
parent b6b5f48055
commit 6f596efadd
13 changed files with 732 additions and 111 deletions
+4
View File
@@ -2,6 +2,7 @@ pub mod common_dto;
pub mod error_dto;
pub mod users;
pub mod permissions;
pub mod audit_log;
// Re-export error type at root level for convenience
pub use error_dto::error::Error;
@@ -25,3 +26,6 @@ pub use users::UsersDetailQueryDto;
pub use permissions::PermissionsEnum;
pub use permissions::PermissionsItemDto;
pub use permissions::PermissionsQueryDto;
// Explicit audit_log exports
pub use audit_log::AuditLogSchema;