Skip to content

Commit 07be090

Browse files
committed
Strip secret fields from grpc logging
1 parent 12722ab commit 07be090

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/gce-pd-csi-driver/utils.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package gceGCEDriver
1919
import (
2020
csi "github.com/container-storage-interface/spec/lib/go/csi"
2121
"github.com/golang/glog"
22+
"github.com/kubernetes-csi/csi-lib-utils/protosanitizer"
2223
"golang.org/x/net/context"
2324
"google.golang.org/grpc"
2425
)
@@ -49,12 +50,12 @@ func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeS
4950

5051
func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
5152
glog.V(3).Infof("GRPC call: %s", info.FullMethod)
52-
glog.V(5).Infof("GRPC request: %+v", req)
53+
glog.V(5).Infof("GRPC request: %+v", protosanitizer.StripSecrets(req))
5354
resp, err := handler(ctx, req)
5455
if err != nil {
5556
glog.Errorf("GRPC error: %v", err)
5657
} else {
57-
glog.V(5).Infof("GRPC response: %+v", resp)
58+
glog.V(5).Infof("GRPC response: %+v", protosanitizer.StripSecrets((resp))
5859
}
5960
return resp, err
6061
}

0 commit comments

Comments
 (0)