Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

br: redact secret strings when logging arguments (#57593) #57604

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #57593

What problem does this PR solve?

Issue Number: close #57585

Problem Summary: Some values from the command line are not properly redacted.

What changed and how does it work?

In additional to the existing handling for --storage, we also apply redaction to the following parameters:

  • --full-backup-storage
  • --crypter.key
  • --log.crypter.key
  • --azblob.encryption-key
  • --master-key (the current implementation of this may be too conservative)

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

When invoking BR in command line with secret keys passed directly from arguments, they are no longer printed as plaintext in the log.

Signed-off-by: kennytm <kennytm@gmail.com>
@ti-chi-bot ti-chi-bot added component/br This issue is related to BR of TiDB. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/bugfix This PR fixes a bug. type/cherry-pick-for-release-8.1 This PR is cherry-picked to release-8.1 from a source PR. labels Nov 21, 2024
br/pkg/task/common.go Outdated Show resolved Hide resolved
br/pkg/task/common_test.go Outdated Show resolved Hide resolved
br/pkg/task/common_test.go Outdated Show resolved Hide resolved
br/pkg/task/common_test.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Please upload report for BASE (release-8.1@a55ea35). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-8.1     #57604   +/-   ##
================================================
  Coverage               ?   71.5027%           
================================================
  Files                  ?       1467           
  Lines                  ?     426073           
  Branches               ?          0           
================================================
  Hits                   ?     304654           
  Misses                 ?     100951           
  Partials               ?      20468           
Flag Coverage Δ
unit 71.5027% <0.0000%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9656% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 41.4831% <0.0000%> (?)

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Nov 22, 2024
Copy link

ti-chi-bot bot commented Dec 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BornChanger, kennytm

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 11, 2024
Copy link

ti-chi-bot bot commented Dec 11, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-22 02:08:54.363183607 +0000 UTC m=+170321.982838125: ☑️ agreed by kennytm.
  • 2024-12-11 08:27:01.660411117 +0000 UTC m=+427011.749213660: ☑️ agreed by BornChanger.

@kennytm
Copy link
Contributor

kennytm commented Dec 11, 2024

/retest

@kennytm
Copy link
Contributor

kennytm commented Dec 11, 2024

/retest

time="2024-12-11T18:02:15+08:00" level=error msg="run test [executor/explain] err: sql:show warnings;: failed to run query 
\"show warnings;\" 
 around line 84, 
we need(208):
show warnings;
Level	Code	Message
explain format = 'plan_cache' select * from t;
id	estRows	task	access object	operator info
TableReader_5	10000.00	root		data:TableFullScan_4
└─TableFullScan_4	10000.00	co
but got(208):
show warnings;
Level	Code	Message
Warning	1105	loading binding from storage takes 55.073µs
Warning	1105	loading binding from storage takes 38.086µs
Warning	1105	loading binding from storage takes 24.969µs

"

@kennytm
Copy link
Contributor

kennytm commented Dec 12, 2024

/retest

Firstly, TestGlobalSortMultiSchemaChange failed to get TSO

    testkit.go:122: 
        	Error Trace:	tests/realtikvtest/testkit.go:122
        	            				tests/realtikvtest/testkit.go:99
        	            				tests/realtikvtest/addindextest2/global_sort_test.go:159
        	Error:      	Received unexpected error:
        	            	[PD:client:ErrClientGetTSO]get TSO failed, tso client is nil
        	            	github.com/tikv/client-go/v2/oracle/oracles.(*pdOracle).getTimestamp
        	            		external/com_github_tikv_client_go_v2/oracle/oracles/pd.go:164
        	            	github.com/tikv/client-go/v2/oracle/oracles.(*pdOracle).GetTimestamp
        	            		external/com_github_tikv_client_go_v2/oracle/oracles/pd.go:110
        	            	github.com/tikv/client-go/v2/oracle/oracles.NewPdOracle
        	            		external/com_github_tikv_client_go_v2/oracle/oracles/pd.go:90
        	            	github.com/tikv/client-go/v2/tikv.NewKVStore
        	            		external/com_github_tikv_client_go_v2/tikv/kv.go:240
        	            	github.com/pingcap/tidb/pkg/store/driver.TiKVDriver.OpenWithOptions
        	            		pkg/store/driver/tikv_driver.go:214
        	            	github.com/pingcap/tidb/pkg/store/driver.TiKVDriver.Open
        	            		pkg/store/driver/tikv_driver.go:110
        	            	github.com/pingcap/tidb/tests/realtikvtest.CreateMockStoreAndDomainAndSetup
        	            		tests/realtikvtest/testkit.go:121
        	            	github.com/pingcap/tidb/tests/realtikvtest.CreateMockStoreAndSetup
        	            		tests/realtikvtest/testkit.go:99
        	            	tests/realtikvtest/addindextest2/addindextest2_test.TestGlobalSortMultiSchemaChange
        	            		tests/realtikvtest/addindextest2/global_sort_test.go:159
        	            	testing.tRunner
        	            		GOROOT/src/testing/testing.go:1595
        	            	runtime.goexit
        	            		src/runtime/asm_amd64.s:1650
        	            	github.com/pingcap/errors.AddStack
        	            		external/com_github_pingcap_errors/errors.go:178
        	            	github.com/pingcap/errors.Trace
        	            		external/com_github_pingcap_errors/juju_adaptor.go:15
        	            	github.com/pingcap/tidb/pkg/store/driver.TiKVDriver.OpenWithOptions
        	            		pkg/store/driver/tikv_driver.go:217
        	            	github.com/pingcap/tidb/pkg/store/driver.TiKVDriver.Open
        	            		pkg/store/driver/tikv_driver.go:110
        	            	github.com/pingcap/tidb/tests/realtikvtest.CreateMockStoreAndDomainAndSetup
        	            		tests/realtikvtest/testkit.go:121
        	            	github.com/pingcap/tidb/tests/realtikvtest.CreateMockStoreAndSetup
        	            		tests/realtikvtest/testkit.go:99
        	            	tests/realtikvtest/addindextest2/addindextest2_test.TestGlobalSortMultiSchemaChange
        	            		tests/realtikvtest/addindextest2/global_sort_test.go:159
        	            	testing.tRunner
        	            		GOROOT/src/testing/testing.go:1595
        	            	runtime.goexit
        	            		src/runtime/asm_amd64.s:1650
        	Test:       	TestGlobalSortMultiSchemaChange

And then, in their retries, TestGlobalSortBasic timed out.

@ti-chi-bot ti-chi-bot bot merged commit 65fd2ad into pingcap:release-8.1 Dec 12, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. component/br This issue is related to BR of TiDB. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/bugfix This PR fixes a bug. type/cherry-pick-for-release-8.1 This PR is cherry-picked to release-8.1 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants