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
- Go to
BigQuery
by visiting: https://console.cloud.google.com/bigquery. - Select the dataset from 'Resources'.
- Click
SHARING
near the right side of the window and selectPermissions
. - Review each attached role.
- Click the delete icon for each member
allUsers
orallAuthenticatedUsers
. On the popup clickRemove
.
From Command Line
List the name of all datasets.
bq ls
Retrieve the data set details:
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
or allAuthenticatedUsers
.
Update the dataset:
bq update --source PATH_TO_FILE PROJECT_ID:DATASET_NAME
Prevention
You can prevent Bigquery dataset from becoming publicly accessible by setting up the Domain restricted sharing
organization policy at: https://console.cloud.google.com/iam-admin/orgpolicies/iam-allowedPolicyMemberDomains.
Default Value
By default, BigQuery datasets are not publicly accessible.
Usage
Run the control in your terminal:
powerpipe control run gcp_compliance.control.cis_v200_7_1
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run gcp_compliance.control.cis_v200_7_1 --share
SQL
This control uses a named query:
bigquery_dataset_not_publicly_accessible