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

使用goInception作为MySQL查询表权限的解析工具 #553

Merged
merged 2 commits into from
Dec 6, 2019

Conversation

hhyo
Copy link
Owner

@hhyo hhyo commented Dec 1, 2019

感谢 @xxlrr 贡献的解析方法

相关issue: #145#446#507
分别对比了sqlparse、moz_sql_parser、Inception,使用goInception实现的表信息解析兼容性最好,索性直接替换成goInception,并且移除了表权限校验失败再次校验库权限的逻辑,当表权限校验失败时直接抛错,不允许查询,后续可针对使用反馈再看是否需要做调整

  • 使用goInception作为MySQL查询表权限的解析工具
  • 在engine的query_check方法中使用explain来对select语句进行语法正确性判断,因为goInception不会提示语法错误信息
  • query_check参数不再对查询权限校验生效,仅作为脱敏校验配置使用
  • 因为移出了二次库权限校验,要使用MySQL查询则必须配置goInception,否则会提示无法校验查询语句权限,请联系管理员

query_check参数不再对查询权限校验生效,仅作为脱敏校验配置使用
@hhyo hhyo added the enhancement New feature or request label Dec 1, 2019
@codecov
Copy link

codecov bot commented Dec 1, 2019

Codecov Report

Merging #553 into master will decrease coverage by 0.06%.
The diff coverage is 92.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #553      +/-   ##
==========================================
- Coverage   81.51%   81.45%   -0.07%     
==========================================
  Files          74       74              
  Lines        9737     9802      +65     
==========================================
+ Hits         7937     7984      +47     
- Misses       1800     1818      +18
Impacted Files Coverage Δ
sql/utils/tasks.py 84.61% <ø> (-0.57%) ⬇️
sql/query_privileges.py 56.92% <100%> (-1.94%) ⬇️
sql/engines/mysql.py 89.9% <100%> (+0.23%) ⬆️
sql/tests.py 100% <100%> (ø) ⬆️
sql/engines/goinception.py 87.69% <84.84%> (-1.09%) ⬇️
sql/sql_workflow.py 74.93% <0%> (+0.77%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0daac43...9624bb2. Read the comment docs.

LeoQuote
LeoQuote previously approved these changes Dec 5, 2019
Copy link
Collaborator

@LeoQuote LeoQuote left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants