Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive audit logging capabilities to the osctrl-admin service, allowing administrators to track all user actions and system interactions within the admin interface.
- Introduces a new audit log system with database persistence and configurable enable/disable functionality
- Adds audit log viewing interface with real-time data display and filtering capabilities
- Integrates audit logging throughout the admin handlers to capture user actions, visits, and configuration changes
Reviewed Changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/auditlog/audit.go | Core audit log manager with database models and logging methods for different action types |
| pkg/auditlog/utils.go | Utility functions for converting log types and severities to human-readable strings |
| pkg/auditlog/utils_test.go | Unit tests for the utility conversion functions |
| pkg/config/flags.go | Adds audit log configuration flag for enabling/disabling the feature |
| pkg/environments/util.go | Adds safety check for zero environment ID in EnvironmentFinderID function |
| pkg/environments/environments.go | Adds ExistsGet method to check environment existence and return the environment |
| cmd/admin/handlers/handlers.go | Integrates audit log manager into the handlers structure with configuration option |
| cmd/admin/handlers/json-audit.go | JSON API endpoint for serving audit log data to the frontend |
| cmd/admin/handlers/types-templates.go | Template data structure for audit log page rendering |
| cmd/admin/templates/audit.html | Frontend template for displaying audit logs with DataTables integration |
| cmd/admin/templates/components/page-aside-right.html | Adds audit log navigation button to admin sidebar |
| cmd/admin/handlers/templates.go | Adds audit log page handler and integrates visit logging across all template handlers |
| cmd/admin/handlers/post.go | Integrates audit logging for all POST actions including login, logout, queries, carves, and configuration changes |
| cmd/admin/handlers/tokens.go | Adds audit logging for token operations and page visits |
| cmd/admin/handlers/get.go | Adds audit logging for file download operations |
| cmd/admin/main.go | Initializes audit log manager and registers audit log routes |
| docker-compose-dev.yml | Enables audit logging in development environment |
| go.mod | Removes unused dependency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Adding audit log capabilities and viewer in
osctrl-admin.