Repository navigation
[release-nextgen-202609] syncer(dm): quote the validator WHERE identifiers - #13027
ti-chi-bot[bot] wants to merge 2 commits into
Conversation
Cond.GetWhere pasted unique-index column names into the verification query unquoted. Column names come from the upstream table schema, so a crafted name (e.g. `a` in (1) -- `) could inject SQL into the validator's COUNT query. Quote every identifier with backticks, doubling any embedded backtick, and cover the escaping with a test.
TestValidatorWorkerUsesVisibleColumns expected the unquoted WHERE clause; the query now quotes the unique-index column name.
|
This cherry pick PR is for a release branch and has not yet been approved by triage owners. To merge this cherry pick:
DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[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 skippedBot user detected. Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.
|
This is an automated cherry-pick of #13008
/assign GMHDBJD
Issue Number: close #13007
What problem does this PR solve?
Cond.GetWhere(dm/syncer/validator_cond.go) builds the WHERE clause of the DM validator's verification query by pasting unique-index column names into the SQL text unquoted. Column names come from the upstream table schema, so a crafted name (e.g.a` in (1) --) injects SQL intoSELECT COUNT(*) FROM <table> WHERE ....What is changed and how it works?
Quote every identifier with backticks and double any embedded backtick. The single- and multi-column forms both go through the helper; expected WHERE strings in the tests are updated and a backtick-named primary-key column covers the escaping.
Check List
Tests
go test ./dm/syncer/Questions
Will it cause performance regression or break compatibility?
No behavior change for ordinary column names.
Release note
Summary by CodeRabbit