Overview
It is recommended that the IAM policy on BigQuery datasets does not allow anonymous and/or public access.
Rationale
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.
Impact
The dataset is not publicly accessible. Explicit modification of IAM privileges would be necessary to make them publicly accessible.
Remediation guidance
From Console
- Go to
BigQueryby visiting: https://console.cloud.google.com/bigquery. - Select the dataset from 'Resources'.
- Click
SHARINGnear the right side of the window and selectPermissions. - Review each attached role.
- Click the delete icon for each member
allUsersorallAuthenticatedUsers. 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.
Service-wide remediation
Recommended when many resources are affected: fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.
Google Cloud
Use organization or folder policies where available, shared project templates, logs and alerting baselines, and IaC modules so new resources inherit the secure setting.
Operational rollout
- Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
- Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
- Re-scan and track approved exceptions with an owner and expiry date.
Query logic
These are the stored checks tied to this control.
BigQuery datasets are not anonymously or publicly accessible
Connectors
Covered asset types
Expected check: eq []
bigQueryTables(where:{OR:[{policyDocument_CONTAINS:"AllUsers"},{policyDocument_CONTAINS:"allAuthenticatedUsers"}]}){...AssetFragment}
Google Cloud