Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytm authored Nov 21, 2024
1 parent 042f40e commit 70dd34b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
5 changes: 1 addition & 4 deletions br/pkg/task/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,10 +747,7 @@ func flagToZapField(f *pflag.Flag) zap.Field {
// hide all query here.
hiddenQuery.RawQuery = ""
return zap.Stringer(f.Name, hiddenQuery)
case flagFullBackupCipherKey, flagLogBackupCipherKey, "azblob.encryption-key":
return zap.String(f.Name, "<redacted>")
case flagMasterKeyConfig:
// TODO: we don't really need to hide the entirety of --master-key, consider parsing the URL here.
case flagCipherKey:
return zap.String(f.Name, "<redacted>")
default:
return zap.Stringer(f.Name, f.Value)
Expand Down
21 changes: 1 addition & 20 deletions br/pkg/task/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,11 @@ func TestUrlNoQuery(t *testing.T) {
expectedValue: "s3://bucket/prefix/",
},
{
inputName: flagFullBackupCipherKey,
inputName: flagCipherKey,
expectedName: "crypter.key",
inputValue: "537570657253656372657456616C7565",
expectedValue: "<redacted>",
},
{
inputName: flagLogBackupCipherKey,
expectedName: "log.crypter.key",
inputValue: "537570657253656372657456616C7565",
expectedValue: "<redacted>",
},
{
inputName: "azblob.encryption-key",
expectedName: "azblob.encryption-key",
inputValue: "SUPERSECRET_AZURE_ENCRYPTION_KEY",
expectedValue: "<redacted>",
},
{
inputName: flagMasterKeyConfig,
expectedName: "master-key",
inputValue: "local:///path/abcd,aws-kms:///abcd?AWS_ACCESS_KEY_ID=SECRET1&AWS_SECRET_ACCESS_KEY=SECRET2&REGION=us-east-1,azure-kms:///abcd/v1?AZURE_TENANT_ID=tenant-id&AZURE_CLIENT_ID=client-id&AZURE_CLIENT_SECRET=client-secret&AZURE_VAULT_NAME=vault-name",
expectedValue: "<redacted>",
// expectedValue: "local:///path/abcd,aws-kms:///abcd,azure-kms:///abcd/v1"
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit 70dd34b

Please sign in to comment.