feat: support auditing#970
Conversation
There was a problem hiding this comment.
Bug: AuditService Session Management & Authorization Flaws
The AuditService incorrectly uses get_async_session() as an async iterator (async for session in get_async_session():), which can lead to database connection leaks and improper session management. Additionally, the /audit-logs/{audit_id} endpoint lacks proper authorization, allowing any authenticated user to access detailed audit logs instead of restricting access to administrators.
aperag/views/audit.py#L96-L101
Lines 96 to 101 in ae7c70b
aperag/service/audit_service.py#L162-L166
ApeRAG/aperag/service/audit_service.py
Lines 162 to 166 in ae7c70b
Bug: Audit Log Access and Filtering Issues
The audit log endpoints (/audit-logs and /audit-logs/{audit_id}) lack administrator authorization, allowing any authenticated user to access sensitive audit data. Additionally, the /audit-logs endpoint accepts username and resource_id query parameters, but these are not passed to the audit service, rendering filtering by these fields non-functional.
aperag/views/audit.py#L29-L66
Lines 29 to 66 in ae7c70b
Was this report helpful? Give feedback by reacting with 👍 or 👎
No description provided.