server: restrict GlobalConfig to its namespace - #11075
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ba839b4 to
078e722
Compare
078e722 to
7d789be
Compare
7d789be to
01c2f84
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-8.5 #11075 +/- ##
===============================================
- Coverage 78.39% 78.30% -0.09%
===============================================
Files 499 500 +1
Lines 68100 68153 +53
===============================================
- Hits 53385 53370 -15
- Misses 10844 10896 +52
- Partials 3871 3887 +16
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Signed-off-by: Ryan Leung <rleungx@gmail.com>
01c2f84 to
4e97971
Compare
Signed-off-by: Ryan Leung <rleungx@gmail.com>
41a24bd to
bee0b99
Compare
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
What problem does this PR solve?
Issue Number: ref #11079
The GlobalConfig gRPC endpoints trust the client-provided
ConfigPathand use it as an etcd key or prefix. A caller that can access PD gRPC can therefore makeStoreGlobalConfig,LoadGlobalConfig, orWatchGlobalConfigoperate outside the intended global-config namespace. Usingpath.Joinfor etcd keys also interprets otherwise literalNamecomponents such as.., which changes the requested key.What is changed and how does it work?
ConfigPathand/global/configto/global/config/.ConfigPathvalues only when their literal byte prefix is/global/config/or the legacy cloud-storage-engine prefixresource_group/controller; etcd treats.,.., duplicate separators, and backslashes as ordinary key bytes.ConfigPath/Nameby string concatenation instead ofpath.Join. An emptyNamecontinues to addressConfigPathitself, so the default path maps it to/global/config./global/config/authorization boundary to Store, Load, and Watch.resource_group/controllerprefix to Store, Load, and Watch through the same validation path.Existing TiDB and TiCDC callers use an empty path and remain compatible. cloud-storage-engine and tikv-one retain their existing
resource_group/controllerprefix Load behavior.Check List
Tests
go test -tags without_dashboard ./client -run '^TestGlobalConfigTestSuite$' -count=1Side effects
ConfigPathvalues outside/global/config/andresource_group/controllernow receiveInvalidArgument.path.Join.Release note