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
Generated
+4
View File
@@ -2123,7 +2123,9 @@ version = "0.1.0"
dependencies = [
"anyhow",
"axum",
"chrono",
"serde",
"serde_json",
"strum 0.27.2",
"strum_macros 0.27.2",
"surrealdb",
@@ -2302,12 +2304,14 @@ dependencies = [
"axum",
"axum-extra",
"axum-test",
"base64 0.22.1",
"chrono",
"futures",
"imphnen-entities",
"imphnen-libs",
"imphnen-utils",
"lazy_static",
"log",
"rand 0.9.2",
"regex",
"serde",