Enhance audit log features with displaying, filtering, exporting, and pagination - #28
Open
mhmharshani wants to merge 13 commits into
Open
Enhance audit log features with displaying, filtering, exporting, and pagination#28mhmharshani wants to merge 13 commits into
mhmharshani wants to merge 13 commits into
Conversation
…sistency in structure
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Audit Logging System Implementation
📝 Summary
Implementation of a comprehensive audit logging system for SecureLaw that provides an immutable record of all system activities. This feature enables admins to monitor AI queries, document processing events, user access logs, and data protection actions in real-time.
🎯 Objective
Establish compliance-ready audit trails for regulatory requirements
Track all sensitive operations including PII masking and AI requests
Provide visibility into user actions and system events
Enable secure data export for compliance reporting
🔧 Changes Made
Models & Services
AuditLog Model: Defines core audit log structure with fields for user ID, action type, timestamp, target resource, and operation details
ActionType Enum: Categorizes system actions (USER_CREATED, USER_UPDATED, USER_DEACTIVATED, AI_REQUEST, ROLE_CHANGED, LOGIN, TEMPLATE_UPDATED, TEST_ACTION)
AuditLogService: HTTP-based service providing:
getAuditLogs(): Retrieve complete audit history with JWT authentication
getPiiStats(): Fetch daily PII masking statistics with optional user/date filters
exportLogs(): Export audit data as CSV for compliance reporting
Admin Components
AuditLogComponent: Standalone Angular component featuring:
Real-time audit log table display with pagination (10 rows/page)
Line chart visualization of daily masked PII counts using Chart.js
Filtering by userId, date range (fromDate/toDate)
CSV export functionality for audit trail documentation
Security badge indicating immutability of logs
Responsive design with Tailwind CSS
UI/UX
An immutable security badge to emphasize tamper-proof logs
Clean admin panel navigation breadcrumbs
Loading states and error handling
Dark mode support with theme transitions
One-click CSV export for compliance teams
📊 Components Affected
AuditLogComponent (Admin Panel)
AuditLogService (Core service layer)
AuditLog model interface
Admin routing & navigation
🔒 Security Features
JWT Bearer token authentication for API calls
Immutable audit trail enforcement
Role-based access (admin-only panel)
Secure data export with file handling
✅ Testing
Unit tests for AuditLogService HTTP calls
Component integration tests for pagination & filtering
CSV export functionality validation
Authentication/authorisation verification
Manual testing of filtering and data visualization
📋 Related Functionality
Integrates with auth.service.ts for user context
Works with role-guard.ts for admin access control
Supports secure-flow-pipeline-service. It's for tracking AI request audit trails
🚀 Future Enhancements
Real-time audit log streaming
Advanced filtering and search
Audit log retention policies
Automated compliance report generation