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 columnscustomer_name,email, andmarket_segment.A user with the Manage security privilege, such as a user with the
accountadminrole.
Create a role and give it access#
Create a role named
analyst. See Create a role.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.
On the Privileges tab, click Add privilege. Select the table
example.sales.customersas 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#
Create a tag named
pii, and apply it to the columnscustomer_nameandemail. See Tags.Go to Access > Roles and privileges, and select the
analystrole.On the Policies tab, click Create Policy.
Enter the name
redact_piiand click Next.Select the catalog
example, and select*in Schemas and Tables. Select Match using expression, enterHAS_TAG(pii), and click Next. The policy covers every column with thepiitag in the catalog, not only the columns of one table.Select ALLOW in Grant, and select the Select privilege.
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
redactwith a description and the expression'REDACTED', and then select it.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#
Create a second policy named
building_onlyfor theanalystrole. Select the same table, and select Match everything in scope.Select ALLOW in Grant, and select the Select privilege.
Click Add row filter. Select Create new row filter, create a row filter named
buildingwith a description and the expressionmarket_segment = 'BUILDING', and then select it.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:
Delete the policies
redact_piiandbuilding_onlyfrom the Policies tab of theanalystrole.Delete the column mask
redactand the row filterbuilding. You can’t delete a column mask or a row filter while a policy uses it.Remove the tag
piifrom the columnscustomer_nameandemail, and then delete the tag.Delete the
analystrole. You can’t delete a role while it has policies.
Next steps#
Learn how roles and privileges work.
Create more rules with policies and row filters and column masks.