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

Skip privilege check in Information schema #29675

Closed
yiwen92 opened this issue Nov 11, 2021 · 4 comments
Closed

Skip privilege check in Information schema #29675

yiwen92 opened this issue Nov 11, 2021 · 4 comments
Assignees
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@yiwen92
Copy link
Contributor

yiwen92 commented Nov 11, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

USE information_schema; 
CREATE user 'daily_dba'; 
GRANT Insert ON *.* TO 'daily_dba'@'%' WITH GRANT OPTION;

2. What did you expect to see? (Required)

exec good without error,just like mysql 8.0

3. What did you see instead (Required)

raise error: (8121, 'privilege check fail')

4. What is your TiDB version? (Required)

Release Version: v5.0.x and v4.0.x

@yiwen92 yiwen92 added the type/bug The issue is confirmed as a bug. label Nov 11, 2021
@yiwen92
Copy link
Contributor Author

yiwen92 commented Nov 11, 2021

this will affect version after 5.1.0, the root cause is no db info in processing process.

@tiancaiamao
Copy link
Contributor

I checked master and master 6512fe5 is not affected

@tiancaiamao
Copy link
Contributor

This is fixed by #23946, for the reason in #24142

It should be if dbName == "" && stmt.Level.Level != ast.GrantLevelGlobal {. There are also no tests on visitInfo for GrantLevelGlobal.

@morgo Would like to cherry-pick that fix to the old branch?

@morgo
Copy link
Contributor

morgo commented Nov 13, 2021

This is fixed by #23946, for the reason in #24142

It should be if dbName == "" && stmt.Level.Level != ast.GrantLevelGlobal {. There are also no tests on visitInfo for GrantLevelGlobal.

@morgo Would like to cherry-pick that fix to the old branch?

I chatted with @yiwen92 about it. It is not quite straight forward to cherry pick (it is based on other changes for dynamic privileges) but it should be easy enough to write a patch specific to 5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

4 participants