From 016901d939874676512c03d8db532cf8a0144539 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 f180f0fb358..15d100dce52 100644 --- a/go/vt/vtgate/executor.go +++ b/go/vt/vtgate/executor.go @@ -160,7 +160,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 4fd3140ba080db8f57e781317ed7e69233809891 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 15d100dce52..73fb0bf6346 100644 --- a/go/vt/vtgate/executor.go +++ b/go/vt/vtgate/executor.go @@ -162,7 +162,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) }