Add write observation interceptors, add validation check, fix default deny filter
This commit is contained in:
8 files changed
+84
-29
No files matched your search
@@ -364,10 +364,10 @@ func isNil(i any) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func auditRequestInterceptor(
|
||||
func eventsRequestInterceptor(
|
||||
_ context.Context,
|
||||
) grpc.UnaryServerInterceptor {
|
||||
const op = "controller.auditRequestInterceptor"
|
||||
const op = "controller.eventsRequestInterceptor"
|
||||
return func(interceptorCtx context.Context,
|
||||
req any,
|
||||
_ *grpc.UnaryServerInfo,
|
||||
@@ -380,16 +380,19 @@ func auditRequestInterceptor(
|
||||
if err := event.WriteAudit(interceptorCtx, op, event.WithRequest(&event.Request{Details: clonedMsg})); err != nil {
|
||||
return req, status.Errorf(codes.Internal, "unable to write request msg audit: %s", err)
|
||||
}
|
||||
if err := event.WriteObservation(interceptorCtx, op, event.WithRequest(&event.Request{Details: clonedMsg})); err != nil {
|
||||
return req, status.Errorf(codes.Internal, "unable to write request msg observation: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
return handler(interceptorCtx, req)
|
||||
}
|
||||
}
|
||||
|
||||
func auditResponseInterceptor(
|
||||
func eventsResponseInterceptor(
|
||||
_ context.Context,
|
||||
) grpc.UnaryServerInterceptor {
|
||||
const op = "controller.auditResponseInterceptor"
|
||||
const op = "controller.eventsResponseInterceptor"
|
||||
return func(interceptorCtx context.Context,
|
||||
req any,
|
||||
_ *grpc.UnaryServerInfo,
|
||||
@@ -405,6 +408,9 @@ func auditResponseInterceptor(
|
||||
if err := event.WriteAudit(interceptorCtx, op, event.WithResponse(&event.Response{Details: clonedMsg})); err != nil {
|
||||
return req, status.Errorf(codes.Internal, "unable to write response msg audit: %s", err)
|
||||
}
|
||||
if err := event.WriteObservation(interceptorCtx, op, event.WithResponse(&event.Response{Details: clonedMsg})); err != nil {
|
||||
return req, status.Errorf(codes.Internal, "unable to write response msg observation: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
return resp, err
|
||||
|
||||
Reference in new issue
Block a user