Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: missing user in login audit (#15156)

ecmadao61d5999d79db
diff --git a/backend/api/v1/audit.go b/backend/api/v1/audit.go
index 39381bef4d..208cc4396e 100644
--- a/backend/api/v1/audit.go
+++ b/backend/api/v1/audit.go
@@ -54,6 +54,10 @@ func createAuditLog(ctx context.Context, request, response any, method string, s
var user string
if u, ok := ctx.Value(common.UserContextKey).(*store.UserMessage); ok {
user = common.FormatUserUID(u.ID)
+ } else {
+ if loginResponse, ok := response.(*v1pb.LoginResponse); ok && loginResponse.User != nil {
+ user = loginResponse.User.Name
+ }
}
st, _ := status.FromError(rerr)