diff --git a/internal/api/audit.go b/internal/api/audit.go index 887f0fb..c59fe9d 100644 --- a/internal/api/audit.go +++ b/internal/api/audit.go @@ -76,6 +76,8 @@ var auditActions = map[string]string{ "POST /api/v1/org/tokens": "token.create", "DELETE /api/v1/org/tokens/:id": "token.delete", + "PUT /api/v1/admin/legal/:kind": "platform.legal_update", + "PUT /api/v1/org/legal/:kind": "org.legal_update", "POST /api/v1/admin/regions": "platform.region_create", "DELETE /api/v1/admin/regions/:id": "platform.region_delete", "POST /api/v1/admin/agents": "platform.agent_create", @@ -131,7 +133,7 @@ func (w *captureWriter) Write(b []byte) (int, error) { // Response fields worth keeping; anything else may be a secret, such as a // freshly created token. -var auditFields = []string{"name", "key", "slug", "email", "type", "target", "domain"} +var auditFields = []string{"name", "key", "slug", "email", "type", "target", "domain", "kind"} // audit records state-changing requests after they ran. func (s *Server) audit() gin.HandlerFunc { @@ -170,6 +172,10 @@ func (s *Server) audit() gin.HandlerFunc { } } } + if status < 400 && strings.HasPrefix(action, "auth.") { + // The address only identifies attempts on unknown accounts. + delete(details, "email") + } for _, param := range []string{"id", "user"} { if id, err := uuid.Parse(c.Param(param)); err == nil { e.TargetID = &id