Get started#

This tutorial shows how to use Starburst access control to give a role access to a table, redact personal data with a tag and a column mask, and limit the rows that the role can see. You use the Control Plane UI to set up the rules, and the query editor to verify the results.

Before you begin#

You need the following:

  • Starburst access control configured in the Control Plane. See Configuration.

  • A governed catalog created in the Control Plane, with a table that contains personal data. This tutorial uses the table example.sales.customers, which has the columns customer_name, email, and market_segment.

  • A user with the Manage security privilege, such as a user with the accountadmin role.

Create a role and give it access#

  1. Create a role named analyst. See Create a role.

  2. On the Users tab of the role, assign your own user to the role. This lets you switch to the role to verify the results.

  3. On the Privileges tab, click Add privilege. Select the table example.sales.customers as the scope, add the Select from table privilege, and click Save privileges.

To verify that the role has access, open the query editor, switch to the analyst role, and run the following query:

SELECT * FROM example.sales.customers LIMIT 10;

The query succeeds and shows all columns and values.

Redact personal data with a tag#

  1. Create a tag named pii, and apply it to the columns customer_name and email. See Tags.

  2. Go to Access > Roles and privileges, and select the analyst role.

  3. On the Policies tab, click Create Policy.

  4. Enter the name redact_pii and click Next.

  5. Select the catalog example, and select * in Schemas and Tables. Select Match using expression, enter HAS_TAG(pii), and click Next. The policy covers every column with the pii tag in the catalog, not only the columns of one table.

  6. Select ALLOW in Grant, and select the Select privilege.

  7. Click Apply to defined scope, select the policy’s scope in Scope, and click Add column mask. Select Create new column mask, create a column mask named redact with a description and the expression 'REDACTED', and then select it.

  8. Click Create policy.

Switch to the analyst role in the query editor and run the query again. The customer_name and email columns now contain the value REDACTED, and the other columns are unchanged.

Limit the rows that a role can see#

  1. Create a second policy named building_only for the analyst role. Select the same table, and select Match everything in scope.

  2. Select ALLOW in Grant, and select the Select privilege.

  3. Click Add row filter. Select Create new row filter, create a row filter named building with a description and the expression market_segment = 'BUILDING', and then select it.

  4. Click Create policy.

Switch to the analyst role in the query editor and run the query again. The query now returns only the rows where market_segment is BUILDING.

Clean up#

To remove the objects that you created, delete them in the following order:

  1. Delete the policies redact_pii and building_only from the Policies tab of the analyst role.

  2. Delete the column mask redact and the row filter building. You can’t delete a column mask or a row filter while a policy uses it.

  3. Remove the tag pii from the columns customer_name and email, and then delete the tag.

  4. Delete the analyst role. You can’t delete a role while it has policies.

Next steps#