-
Notifications
You must be signed in to change notification settings - Fork 14k
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: table schema permissions #23356
Conversation
Codecov Report
@@ Coverage Diff @@
## master #23356 +/- ##
=======================================
Coverage 67.52% 67.52%
=======================================
Files 1907 1907
Lines 73445 73457 +12
Branches 7975 7976 +1
=======================================
+ Hits 49591 49602 +11
Misses 21806 21806
- Partials 2048 2049 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
629aecd
to
b72a937
Compare
8d49f33
to
f700132
Compare
SUMMARY
When a user runs a query in SQL Lab referencing a table without an explicit schema, we check permissions using the query schema. For most databases this will allow users to query schemas that they shouldn't have access to. This happens because the SQLAlchemy connection is never changed to have the query schema set as the default schema in which the query runs; for these databases, we should check permissions using the default database schema instead.
In this example with Postgres, a user has access to only the
secret
schema. They select thesecret
schema in SQL Lab and run the following query:The database will run the query against the default schema,
public
, returning data. Superset will check if the user has access to thesecret
schema instead, allowing the query to run and returning results to the user:With this fix the user is restricted:
TESTING INSTRUCTIONS
secret
to a database.secret
that has the permission[schema access on [PostgreSQL].[secret]]
.sql_lab
andsecret
.secret
schema in SQL Lab and runSELECT * FROM ab_user
.ADDITIONAL INFORMATION