Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Don't log secret of s3. #292

Merged
merged 8 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/backup/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,12 @@ func SendBackup(
req kvproto.BackupRequest,
respFn func(*kvproto.BackupResponse) error,
) error {
log.Info("try backup", zap.Any("backup request", req))
log.Info("try backup",
zap.Binary("StartKey", req.StartKey),
zap.Binary("EndKey", req.EndKey),
zap.Uint64("RateLimit", req.RateLimit),
zap.Uint32("Concurrency", req.Concurrency),
YuJuncen marked this conversation as resolved.
Show resolved Hide resolved
)
ctx, cancel := context.WithCancel(ctx)
defer cancel()
bcli, err := client.Backup(ctx, &req)
Expand Down
22 changes: 20 additions & 2 deletions tests/br_s3/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,33 @@ done

# backup full
echo "backup start..."
run_br --pd $PD_ADDR backup full -s "s3://mybucket/$DB?endpoint=http://$S3_ENDPOINT"
BACKUP_LOG="backup.log"
rm -f $BACKUP_LOG
unset BR_LOG_TO_TERM
run_br --pd $PD_ADDR backup full -s "s3://mybucket/$DB?endpoint=http://$S3_ENDPOINT" --log-file $BACKUP_LOG || \
(cat $BACKUP_LOG && exit 1)

if grep -i $MINIO_SECRET_KEY $BACKUP_LOG; then
echo "Secret key logged in log. Please remove them."
exit 1
fi

for i in $(seq $DB_COUNT); do
run_sql "DROP DATABASE $DB${i};"
done

# restore full
echo "restore start..."
run_br restore full -s "s3://mybucket/$DB" --pd $PD_ADDR --s3.endpoint="http://$S3_ENDPOINT"
RESTORE_LOG="restore.log"
rm -f $RESTORE_LOG
run_br restore full -s "s3://mybucket/$DB" --pd $PD_ADDR --s3.endpoint="http://$S3_ENDPOINT" --log-file $RESTORE_LOG || \
(cat $RESTORE_LOG && exit 1)
BR_LOG_TO_TERM=1

if grep -i $MINIO_SECRET_KEY $RESTORE_LOG; then
echo "Secret key logged in log. Please remove them."
exit 1
fi

for i in $(seq $DB_COUNT); do
row_count_new[${i}]=$(run_sql "SELECT COUNT(*) FROM $DB${i}.$TABLE;" | awk '/COUNT/{print $2}')
Expand Down