Skip to content

feat(#101): audit logging for sensitive endpoint access#124

Merged
dennisonbertram merged 1 commit intomainfrom
issue-101-audit-sensitive-access
Mar 21, 2026
Merged

feat(#101): audit logging for sensitive endpoint access#124
dennisonbertram merged 1 commit intomainfrom
issue-101-audit-sensitive-access

Conversation

@dennisonbertram
Copy link
Owner

Summary

  • Logs AUDIT events when connection-string, admin-token, or env?reveal=true are accessed
  • Includes tenant ID, resource ID, and API key ID in log entries
  • Adds key ID to request context via auth middleware
  • 4 new tests verifying audit log output

Test plan

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>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@dennisonbertram dennisonbertram merged commit c7c135f into main Mar 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(audit): log access to sensitive endpoints (connection-string, admin-token, env reveal)

1 participant