metabase / metabase

The simplest, fastest way to get business intelligence and analytics to everyone in your company :yum:
https://metabase.com
Other
38.4k stars 5.09k forks source link

Column sandboxing powered by a SQL question still shows all columns in query builder, leading to errors #48707

Closed noahmoss closed 2 hours ago

noahmoss commented 2 hours ago

Describe the bug

As an admin, you can set up a sandbox powered by a SQL question which selects a subset of columns from a table, in order to restrict the columns which a user should have access to.

However, the user still is able to see the full list of columns in the query builder, and thus might try to create a query which will subsequently error due to the sandbox.

To Reproduce

  1. As an admin, create a SQL question as a base for sandboxing like:
    select ID, USER_ID, TAX, TOTAL from ORDERS where USER_ID = 1;
  2. Sandbox Orders table for "All users" using this SQL question
  3. Log in as a non-admin, and start a new question using the query builder
  4. You'll be able to see the full list of fields in the table in the query builder, and if you try to create a question that includes all fields, you will get an error

Expected behavior

No response

Logs

No response

Information about your Metabase installation

n/a (already fixed)

Severity

P1

Additional context

No response

noahmoss commented 2 hours ago

Fixed by https://github.com/metabase/metabase/pull/48577