From 46e82d063dc7f1b17a86d417ea540702944bba31 Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Tue, 21 Mar 2023 15:54:26 -0400 Subject: [PATCH 1/2] backupccl: stop logging unsanitized backup stmt in schedule executor Informs #99145 Release note: None --- pkg/ccl/backupccl/schedule_exec.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/ccl/backupccl/schedule_exec.go b/pkg/ccl/backupccl/schedule_exec.go index d572019bd952..dcb807dd04ba 100644 --- a/pkg/ccl/backupccl/schedule_exec.go +++ b/pkg/ccl/backupccl/schedule_exec.go @@ -97,8 +97,7 @@ func (e *scheduledBackupExecutor) executeBackup( } backupStmt.AsOf = tree.AsOfClause{Expr: endTime} - log.Infof(ctx, "Starting scheduled backup %d: %s", - sj.ScheduleID(), tree.AsString(backupStmt)) + log.Infof(ctx, "Starting scheduled backup %d", sj.ScheduleID()) // Invoke backup plan hook. hook, cleanup := cfg.PlanHookMaker("exec-backup", txn.KV(), sj.Owner()) From 97243f65450a91a090aa9876cabab215b175f9d1 Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Wed, 22 Mar 2023 13:41:27 -0400 Subject: [PATCH 2/2] backupccl: scrub backup stmt from return errors This patch ensures that no unsanitized uris or secret keys get written to the jobs table if the backup fails. Informs #99145 Release note: None --- pkg/ccl/backupccl/schedule_exec.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/ccl/backupccl/schedule_exec.go b/pkg/ccl/backupccl/schedule_exec.go index dcb807dd04ba..63e35ad255ca 100644 --- a/pkg/ccl/backupccl/schedule_exec.go +++ b/pkg/ccl/backupccl/schedule_exec.go @@ -147,10 +147,10 @@ func planBackup( ) (sql.PlanHookRowFn, error) { fn, cols, _, _, err := backupPlanHook(ctx, backupStmt, p) if err != nil { - return nil, errors.Wrapf(err, "backup eval: %q", tree.AsString(backupStmt)) + return nil, errors.Wrapf(err, "failed to evaluate backup stmt") } if fn == nil { - return nil, errors.Newf("backup eval: %q", tree.AsString(backupStmt)) + return nil, errors.Newf("failed to evaluate backup stmt") } if len(cols) != len(jobs.DetachedJobExecutionResultHeader) { return nil, errors.Newf("unexpected result columns")