rbd: modify stripSecret mechanism in logGRPC()

This commit updates csi-addons spec version
and modifies logging to strip replication
request secret using csi.StripSecret, then
with replication.protosanitizer if the former
fails. This is done in order to make sure
we strip csi and replication format of secrets.

Signed-off-by: Rakshith R <rar@redhat.com>
(cherry picked from commit 40134772a7)
This commit is contained in:
Rakshith R
2022-08-29 12:29:22 +05:30
committed by mergify[bot]
parent 2f393f24b7
commit 3a4c7c9d79
5 changed files with 200 additions and 208 deletions

View File

@ -193,12 +193,18 @@ func logGRPC(
handler grpc.UnaryHandler,
) (interface{}, error) {
log.ExtendedLog(ctx, "GRPC call: %s", info.FullMethod)
// TODO: remove the following check for next release
// refer to https://github.com/ceph/ceph-csi/issues/3314.
if isReplicationRequest(req) {
log.TraceLog(ctx, "GRPC request: %s", rp.StripReplicationSecrets(req))
strippedMessage := protosanitizer.StripSecrets(req).String()
if !strings.Contains(strippedMessage, "***stripped***") {
strippedMessage = rp.StripReplicationSecrets(req).String()
}
log.TraceLog(ctx, "GRPC request: %s", strippedMessage)
} else {
log.TraceLog(ctx, "GRPC request: %s", protosanitizer.StripSecrets(req))
}
resp, err := handler(ctx, req)
if err != nil {
klog.Errorf(log.Log(ctx, "GRPC error: %v"), err)