-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Fix SQL Lab schema permission checks #9756
Conversation
04c1cbd
to
a865be6
Compare
Codecov Report
@@ Coverage Diff @@
## master #9756 +/- ##
===========================================
- Coverage 70.49% 53.78% -16.72%
===========================================
Files 402 352 -50
Lines 12564 11232 -1332
Branches 3112 2782 -330
===========================================
- Hits 8857 6041 -2816
- Misses 3593 5011 +1418
- Partials 114 180 +66
Continue to review full report at Codecov.
|
ae926df
to
9d947a0
Compare
9d947a0
to
6c4d8b2
Compare
superset/security/manager.py
Outdated
query = sql_parse.ParsedQuery(sql) | ||
|
||
return { | ||
table | ||
for table in query.tables | ||
if not self.can_access_datasource(database, table, schema) | ||
if not self.can_access_datasource(database, table, table.schema or schema) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this line should be reverted, i.e., the schema
is the fallback schema per the docstring and can_access_datasource
should be changed to be,
schema_perm = self.get_schema_perm(database, table.schema or schema)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@john-bodley good point, that is more appropriate place. updated the PR.
056d694
to
18d2967
Compare
18d2967
to
e6290a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for adding the tests.
@john-bodley could you merge it, I am still waiting on getting the rights |
CATEGORY
Choose one
SUMMARY
Fixes #9754
Schema permission checks on the table in the sqllab
Also this change adds the unit tests to prevent future regressions.
TEST PLAN
[x] unit tests
[x] local test
[ ] dropbox staging - TBD
ADDITIONAL INFORMATION
REVIEWERS
@john-bodley