This commit is contained in:
Timothy Jaeryang Baek
2026-07-23 22:52:23 -04:00
parent 43e7eefa95
commit 2ef6c76f51
2 changed files with 16 additions and 8 deletions
+6 -2
View File
@@ -132,8 +132,12 @@ class AuditLoggingMiddleware:
) -> None:
self.app = app
self.audit_logger = AuditLogger(logger)
self.excluded_paths = excluded_paths or []
self.included_paths = included_paths or []
def normalize_paths(paths: Optional[list[str]]) -> list[str]:
return [path for path in (path.strip().lstrip('/') for path in paths or []) if path]
self.excluded_paths = normalize_paths(excluded_paths)
self.included_paths = normalize_paths(included_paths)
self.max_body_size = max_body_size
self.audited_methods = set(self.DEFAULT_AUDITED_METHODS)
if audit_get_requests: