Hiding Columns in Google BigQuery

Managing fine-grained data access control for sensitive data

Soumendra Mishra
Google Cloud - Community
4 min readAug 7, 2020

--

BigQuery provides fine-grained access to columns using policy tags. When a user tries to access a restricted column at query time, BigQuery checks for column policy tag and its policy to see if the user is authorized to access the data. Following steps outlines implementation strategy for managing data access control in BigQuery:
Step-1: Define data catalog roles for admins and application users
Step-2: Define data catalog taxonomy and policy tags
Step-3: Apply column-level security on BigQuery column
Step-4: Verify data access with column-level security

Identity and Access Management (IAM) Roles

Applying column-level security requires multiple IAM roles. BigQuery column-level security requires following Data Catalog roles :

Data Catalog Roles

Create a Business Taxonomy

Data Catalog taxonomy is used to create hierarchical groups of policy tags to control column access in BigQuery. Following steps required to create Data Catalog taxonomy and Policy tags:
1. Open Data Catalog
2. Navigate to “Policy Tags” and click “Create and Manage Policy Tag”
3. Click Create
4. Enter taxonomy name (example: Business Taxonomy)and description
5. Select project name and location
6. Enter a policy tag name and description
7. Click “Add Child Policy Tag” to add a child policy tag (if required)

Policy Tags
Enable Access Control

Data Access without Column-Level Security

Data access without column-level security allows to access all columns without any restriction.

BigQuery Schema (without access control)

Apply Column-Level Security on BigQuery Column

In BigQuery, column-level security is implemented on a column through policy tag. As a result, only authorized users can able to access the restricted column and other users have access to the remaining columns. Policy tag is added to a column using following steps:
1. Open BigQuery
2. Click on Table (example: employee)
3. Under Schema tab, click “Edit Schema”
4. Select a column (example: salary) and click “Add Policy Tag”
5. In “Add a Policy Tag” screen, select the policy tag (example: Restricted)

Policy Tag on Column
BigQuery Schema (with access control)

Data Access with Column-Level Security

In this example, SELECT * command failed because column-level security is added on a column (salary) and the user does not have the “Data Catalog Fine-Grained Reader” role to access the restricted column.

The query is modified to exclude the column(salary) that the user cannot access but have access to the remaining columns. Now, the query is executed successfully.

Conclusion

Data access control is an integral part of an organization to safeguard sensitive data and restricting column data from unauthorized user access helps to build trust and security compliance.

--

--

Soumendra Mishra
Google Cloud - Community

Passionate Leader, Technology Enthusiast, Innovator, and Mentor