From ca705e6f454beca42ef2376ad792d37b93fee7a9 Mon Sep 17 00:00:00 2001 From: Andres Taylor Date: Thu, 1 Apr 2021 08:23:20 +0200 Subject: [PATCH 1/2] make sure to not log sensitive information Signed-off-by: Andres Taylor --- go/vt/vtgate/executor.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/go/vt/vtgate/executor.go b/go/vt/vtgate/executor.go index dec82d79380..994e28386c4 100644 --- a/go/vt/vtgate/executor.go +++ b/go/vt/vtgate/executor.go @@ -157,7 +157,11 @@ func (e *Executor) Execute(ctx context.Context, method string, safeSession *Safe saveSessionStats(safeSession, stmtType, result, err) if result != nil && len(result.Rows) > *warnMemoryRows { warnings.Add("ResultsExceeded", 1) - log.Warningf("%q exceeds warning threshold of max memory rows: %v", sql, *warnMemoryRows) + piiSafeSQL, err := sqlparser.RedactSQLQuery(sql) + if err != nil { + piiSafeSQL = sqlparser.Preview(sql).String() + } + log.Warningf("%q exceeds warning threshold of max memory rows: %v", piiSafeSQL, *warnMemoryRows) } logStats.Send() From b720ad09200eba5430caab8a0e9bcb75296575ca Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Thu, 1 Apr 2021 15:27:00 +0530 Subject: [PATCH 2/2] addressed review comments Signed-off-by: Harshit Gangal --- go/vt/vtgate/executor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/vtgate/executor.go b/go/vt/vtgate/executor.go index 994e28386c4..6a23241d200 100644 --- a/go/vt/vtgate/executor.go +++ b/go/vt/vtgate/executor.go @@ -159,7 +159,7 @@ func (e *Executor) Execute(ctx context.Context, method string, safeSession *Safe warnings.Add("ResultsExceeded", 1) piiSafeSQL, err := sqlparser.RedactSQLQuery(sql) if err != nil { - piiSafeSQL = sqlparser.Preview(sql).String() + piiSafeSQL = logStats.StmtType } log.Warningf("%q exceeds warning threshold of max memory rows: %v", piiSafeSQL, *warnMemoryRows) }