-
Notifications
You must be signed in to change notification settings - Fork 2
feat(audit): complete audit log system #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
27493d1
feat(audit): add audit_logs migration (015)
ffbf024
feat(audit): add audit log middleware
960f008
feat(audit): add audit log API route
7110b88
feat(audit): wire audit log into API router and config
2fd37cc
feat(audit): add retention cleanup to scheduler
72eb150
feat(audit): add dashboard page, API proxy, and sidebar nav
5375ead
test(audit): add audit log route and middleware tests
f9756da
fix(audit): address review — middleware ordering, sensitive data mask…
5944454
fix(audit): strip query string from path and use guild-scoped getConfig
e649865
fix(web): use keyed Fragment component in audit log row map
20c33fa
fix(audit): validate and clamp retentionDays for purge interval
c8b9275
fix(db): add created_at index for audit log retention purge
01bcaa2
chore(lint): format audit log middleware and remove unused React import
67ac647
test(audit): account for guild-scoped config snapshots in PATCH confi…
e30e44a
fix(audit): round 2 — query string, guild config, retention index, va…
70a98ae
test(web): use safe unknown cast for createdAnchor typecheck
d2ccbda
Fix audit log config scope and query filter validation
d2ab87f
fix: resolve merge conflict with main - keep both runMaintenance and …
BillChirico File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /** | ||
| * Migration 015 — Audit Logs | ||
| * Creates the audit_logs table for tracking admin actions in the web dashboard. | ||
| * | ||
| * @see https://github.com/VolvoxLLC/volvox-bot/issues/123 | ||
| */ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| /** | ||
| * @param {import('pg').Pool} pool | ||
| */ | ||
| async function up(pool) { | ||
| await pool.query(` | ||
| CREATE TABLE IF NOT EXISTS audit_logs ( | ||
| id SERIAL PRIMARY KEY, | ||
| guild_id VARCHAR(32) NOT NULL, | ||
| user_id VARCHAR(32) NOT NULL, | ||
| action VARCHAR(128) NOT NULL, | ||
| target_type VARCHAR(64), | ||
| target_id VARCHAR(64), | ||
| details JSONB, | ||
| ip_address VARCHAR(45), | ||
| created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() | ||
| ); | ||
| `); | ||
|
|
||
| await pool.query(` | ||
| CREATE INDEX IF NOT EXISTS idx_audit_logs_guild_created | ||
| ON audit_logs(guild_id, created_at DESC); | ||
| `); | ||
BillChirico marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| await pool.query(` | ||
| CREATE INDEX IF NOT EXISTS idx_audit_logs_created_at | ||
| ON audit_logs(created_at); | ||
| `); | ||
| } | ||
|
|
||
| module.exports = { up }; | ||
BillChirico marked this conversation as resolved.
Show resolved
Hide resolved
BillChirico marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.