Skip to content

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

feat: audit export (#11747)

p0ny0f7bacaaa7df
diff --git a/backend/api/v1/audit.go b/backend/api/v1/audit.go
index bda0993d5d..2aecd8e893 100644
--- a/backend/api/v1/audit.go
+++ b/backend/api/v1/audit.go
@@ -8,6 +8,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/encoding/protojson"
+ "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
"github.com/pkg/errors"
@@ -38,6 +39,8 @@ func getRequestResource(request any) string {
switch r := request.(type) {
case *v1pb.QueryRequest:
return r.Name
+ case *v1pb.ExportRequest:
+ return r.Name
case *v1pb.CreateUserRequest:
return ""
default:
@@ -53,6 +56,11 @@ func getRequestString(request any) (string, error) {
switch r := request.(type) {
case *v1pb.QueryRequest:
return r
+ case *v1pb.ExportRequest:
+ //nolint:revive
+ r = proto.Clone(r).(*v1pb.ExportRequest)
+ r.Password = ""
+ return r
case *v1pb.CreateUserRequest:
return r
default:
@@ -77,6 +85,8 @@ func getResponseString(response any) (string, error) {
switch r := response.(type) {
case *v1pb.QueryResponse:
return nil
+ case *v1pb.ExportResponse:
+ return nil
case *v1pb.User:
return &v1pb.User{
Name: r.Name,
@@ -102,6 +112,7 @@ func isAuditMethod(method string) bool {
switch method {
case
v1pb.AuthService_CreateUser_FullMethodName,
+ v1pb.SQLService_Export_FullMethodName,
v1pb.SQLService_Query_FullMethodName:
return true
default: