*: refactor the RestrictedSQLExecutor interface (#22579)#22687
Merged
tiancaiamao merged 4 commits intopingcap:release-5.0-rcfrom Feb 22, 2021
Merged
*: refactor the RestrictedSQLExecutor interface (#22579)#22687tiancaiamao merged 4 commits intopingcap:release-5.0-rcfrom
tiancaiamao merged 4 commits intopingcap:release-5.0-rcfrom
Conversation
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Contributor
Author
|
/run-all-tests |
Contributor
Author
|
@tiancaiamao you're already a collaborator in bot's repo. |
Member
|
Please try to resolve the conflicts @tiancaiamao |
…elease-5.0-rc-ea6ccf82e934
xhebox
reviewed
Feb 22, 2021
store/tikv/gcworker/gc_worker.go
Outdated
| if len(rs) > 0 { | ||
| defer terror.Call(rs[0].Close) | ||
| } | ||
| defer terror.Call(rs.Close) |
Contributor
There was a problem hiding this comment.
This defer should be moved after the err != nil check
Member
|
/mergte |
Member
|
/merge |
Contributor
Author
|
/run-all-tests |
Contributor
Author
|
@ti-srebot merge failed. |
Contributor
|
/run-unit-test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cherry-pick #22579 to release-5.0-rc
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/22687After 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