Control: 7.1 Ensure that BigQuery datasets are not anonymously or publicly accessible
Description
It is recommended that the IAM policy on BigQuery datasets does not allow anonymous and/or public access.
Granting permissions to allUsers or allAuthenticatedUsers allows anyone to access the dataset. Such access might not be desirable if sensitive data is being stored in the dataset. Therefore, ensure that anonymous and/or public access to a dataset is not allowed.
Remediation
From Console
- Login to BigQuery.
- Select the dataset from
Resources
. - Click SHARE DATASET near the right side of the window.
- Review each attached role.
- Click the delete icon for each member
allUsers
orallAuthenticatedUsers
. On the popup click Remove.
From Command Line
- Retrieve the data set information:
bq show --format=prettyjson PROJECT_ID:DATASET_NAME > PATH_TO_FILE
In the access section of the JSON file, update the dataset information to remove all roles containing
allUsers
orallAuthenticatedUsers
.Update the dataset:
bq update --source PATH_TO_FILE PROJECT_ID:DATASET_NAME
Usage
Run the control in your terminal:
powerpipe control run gcp_compliance.control.cis_v120_7_1
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run gcp_compliance.control.cis_v120_7_1 --share
SQL
This control uses a named query:
bigquery_dataset_not_publicly_accessible