feat(#101): audit logging for sensitive endpoint access#124
feat(#101): audit logging for sensitive endpoint access#124dennisonbertram merged 1 commit intomainfrom
Conversation
Log access to connection-string, admin-token, and env?reveal=true endpoints with tenant ID, resource ID, and API key ID for compliance auditing. The auth middleware now propagates the API key ID into the request context so handlers can include it in structured AUDIT lines. Closes #101 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96ea141559
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| if reveal { | ||
| keyID := middleware.GetKeyID(r.Context()) | ||
| log.Printf("AUDIT: action=env.revealed tenant=%s service=%s api_key=%s", tenantID, serviceID, keyID) |
There was a problem hiding this comment.
Remove duplicate env-reveal audit entry
When GET /v1/services/{serviceID}/env?reveal=true succeeds, this new handler log emits action=env.revealed in addition to the existing audit log already emitted inside services.Manager.GetEnv (internal/services/services.go, GetEnv, around line 1180). That means each successful reveal now generates two AUDIT records for one access, which can inflate audit counters/alerts and make downstream monitoring ambiguous. Consider logging in only one layer (or replacing the manager log) so each reveal produces a single audit event.
Useful? React with 👍 / 👎.
Summary
Test plan
TestAuditLog_ConnectionStringTestAuditLog_AdminTokenTestAuditLog_EnvRevealTestAuditLog_IncludesKeyIDgo test ./...passesCloses feat(audit): log access to sensitive endpoints (connection-string, admin-token, env reveal) #101
🤖 Generated with Claude Code