MCPcopy Create free account
hub / github.com/PostHog/duckgres / AdminAuditEntry

Struct AdminAuditEntry

controlplane/admin/audit.go:19–37  ·  view source on GitHub ↗

AdminAuditEntry is one append-only record of an admin-UI action. Every mutation (config-store write, user/secret change) and every impersonation statement writes a row. SQL text is stored already-redacted by the caller — never store raw secret DDL here.

Source from the content-addressed store, hash-verified

17// mutation (config-store write, user/secret change) and every impersonation
18// statement writes a row. SQL text is stored already-redacted by the caller —
19// never store raw secret DDL here.
20type AdminAuditEntry struct {
21 ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
22 Timestamp time.Time `gorm:"index" json:"ts"`
23 Actor string `gorm:"index" json:"actor"` // SSO email or "internal-secret"
24 Role string `json:"role"` // viewer/admin
25 Source string `json:"source"` // sso / internal-secret
26 Action string `gorm:"index" json:"action"` // e.g. "config.update", "impersonate.query"
27 Method string `json:"method"`
28 Path string `json:"path"`
29 Org string `gorm:"index" json:"org"`
30 TargetUser string `json:"target_user"`
31 SQLRedacted string `json:"sql_redacted"`
32 // Detail is optional, non-sensitive human context for the action (e.g.
33 // "role viewer → admin" for an operator change). Set by a handler via
34 // requestaudit.SetDetail; NEVER put credentials or raw secret DDL here.
35 Detail string `json:"detail"`
36 // Outcome is an optional machine-readable durable result. It distinguishes
37 // a mutation that landed before later response-path work failed from one
38 // that never happened. It must never contain identifiers or secrets.
39 Outcome string `json:"outcome"`
40 Status int `json:"status"`

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected