*: refactor the RestrictedSQLExecutor interface (#22579)#22621
*: refactor the RestrictedSQLExecutor interface (#22579)#22621ti-chi-bot merged 6 commits intopingcap:release-4.0from
Conversation
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
|
/run-all-tests |
|
@tiancaiamao you're already a collaborator in bot's repo. |
|
Depends on #22548 |
|
/run-check_dev |
…ase-4.0-ea6ccf82e934
|
/lgtm |
|
/rebuild |
|
PTAL @morgo |
|
/lgtm |
|
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. DetailsReviewer can indicate their review by writing |
|
/merge |
|
@morgo: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. 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 ti-community-infra/tichi repository. |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: a609db6 |
cherry-pick #22579 to release-4.0
You can switch your code base to this Pull Request by using git-extras:
# In tidb repo: git pr https://github.com/pingcap/tidb/pull/22621After apply modifications, you can push your change to this PR via:
What problem does this PR solve?
Problem Summary:
Improve security for our code.
What is changed and how it works?
The initial definition of
RestrictedSQLExecutorlooks like this:It's not good for security reasons, the usage pattern looks like this:
Later on, we add more methods to the interface which IMO, ugly:
I propose to use this one as its new definition:
This interface is secure, and easy to use:
What's Changed:
ParseWithParams()now returnsast.StmtNoderather than[]ast.StmtNode, multiple statements are not allowed here.Update the "util", "store", and "domain" packages, ensure they use the new (secure) API.
How it Works:
Related changes
Check List
Tests
Side effects
API change
Release note