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

executor, privileges: fix privilege check fail for CREATE USER and DROP USER #11589

Merged
merged 7 commits into from
Aug 19, 2019

Conversation

imtbkcat
Copy link

@imtbkcat imtbkcat commented Aug 2, 2019

What problem does this PR solve?

fix #9111

What is changed and how it works?

This problem was caused by using ctx.Execute(sql) to modify system privilege table. If user do not have privilege to insert or date to mysql.User, SQL execution will fail user had CREATE USER privilege.

Using system session to execute sql to modify mysql.User will fix this problem.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change
  • Has exported variable/fields change

Side effects

  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 2, 2019
@codecov
Copy link

codecov bot commented Aug 2, 2019

Codecov Report

Merging #11589 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #11589   +/-   ##
===========================================
  Coverage   81.7735%   81.7735%           
===========================================
  Files           435        435           
  Lines         94604      94604           
===========================================
  Hits          77361      77361           
  Misses        11798      11798           
  Partials       5445       5445

@tiancaiamao
Copy link
Contributor

PTAL @lysu

@qw4990 qw4990 removed their request for review August 14, 2019 07:34
jackysp
jackysp previously approved these changes Aug 19, 2019
Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jackysp jackysp added the status/can-merge Indicates a PR has been approved by a committer. label Aug 19, 2019
@imtbkcat
Copy link
Author

/run-all-tests

@jackysp jackysp added status/can-merge Indicates a PR has been approved by a committer. and removed status/can-merge Indicates a PR has been approved by a committer. labels Aug 19, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Aug 19, 2019

/run-all-tests

@sre-bot sre-bot merged commit 8a4b60c into pingcap:master Aug 19, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Aug 19, 2019

cherry pick to release-3.0 failed

@sre-bot
Copy link
Contributor

sre-bot commented Aug 19, 2019

cherry pick to release-2.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Apr 7, 2020

It seems that, not for sure, we failed to cherry-pick this commit to release-2.1 release-3.0. Please comment '/run-cherry-picker' to try to trigger the cherry-picker if we did fail to cherry-pick this commit before. @imtbkcat PTAL.

@imtbkcat
Copy link
Author

imtbkcat commented Apr 8, 2020

/run-cherry-picker

sre-bot pushed a commit to sre-bot/tidb that referenced this pull request Apr 8, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Apr 8, 2020

cherry pick to release-2.1 in PR #16158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/privilege sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CREATE USER/DROP USER privilege check is incorrect
5 participants