Repository navigation
feat(api): optional stdout audit sink + surface dropped audit writes - #16
Merged
Merged
Conversation
Closes the remaining half of the documented audit limitation ("no
external sink"). Rather than build a bespoke S3/syslog pusher, mirror
each audit event to stdout as a structured JSON line so the cluster's
existing log aggregator (Loki/ELK/CloudWatch, all of which scrape pod
stdout) captures the audit trail — the Kubernetes-native external sink.
- audit.New takes functional options; WithStdoutSink(logger) enables the
mirror. Off by default; events always still land in the database.
- Opt in via --audit-stdout / GAMEPLANE_AUDIT_STDOUT, surfaced through
the Helm chart as api.audit.stdout.
- Also stop silently discarding the audit INSERT error: a dropped
security-audit write now logs a warning so a hole in the trail is
visible instead of invisible.
- README known-limitations updated.
Tests: the sink emits the audited fields and still records to the DB;
the default (no sink) path doesn't panic and still records.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: valgulnecron <39313199+ValgulNecron@users.noreply.github.com>
ValgulNecron
pushed a commit
that referenced
this pull request
Oct 11, 2026
modules: GameplanePanel/module#49 (hell-let-loose removed). website: GameplanePanel/website#15 and #16 (module count text). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.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.
What
Closes the remaining half of the README's audit limitation — "there is no external sink (S3/syslog)." Instead of a bespoke S3/syslog pusher, the API can mirror each audit event to stdout as a structured JSON line, so the cluster's existing log aggregator (Loki / ELK / CloudWatch — all scrape pod stdout) captures the audit trail. That's the Kubernetes-native external sink (rule 9: compose stock primitives — the pod's stdout is the log pipeline).
How
audit.Newnow takes functional options;WithStdoutSink(logger)enables the mirror. Off by default; events always still land in the database (the sink mirrors, never replaces).--audit-stdout/GAMEPLANE_AUDIT_STDOUT, surfaced through the Helm chart asapi.audit.stdout.INSERTerror (_, _ = ExecContext→ captured): a dropped security-audit write now logs a warning, so a hole in the trail is visible rather than invisible.Tests
TestMiddleware_StdoutSinkasserts the sink line carries the audited fields (actor/method/path/target/status) and the event still lands in the DB;TestMiddleware_NoSinkByDefaultcovers the default (no sink → no panic, still recorded). Verifiedhelm templaterenders--audit-stdoutonly whenapi.audit.stdout=true.Notes
No schema change (no migration). No Pencil pass (no dashboard surface). Builds on the merged #14 audit retention work.
🤖 Generated with Claude Code