Skip to main content

More Info:

It is recommended that the IAM policy on BigQuery datasets does not allow anonymous and/or public access.

Risk Level

Medium

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CIS GCP
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • FedRAMP
  • GDPR
  • HITRUST CSF
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST CSF
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • PCI
  • Reserve Bank of India (RBI) Cyber Security Framework
  • Reserve Bank of India (RBI) Master Direction – Information Technology Framework
  • SOC2
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate this misconfiguration in GCP using GCP console, you can follow these steps:
  1. Open the GCP console and navigate to the BigQuery section.
  2. Click on the dataset that you want to remediate.
  3. In the dataset details page, click on the “Share dataset” button.
  4. In the “Share dataset” dialog box, review the current access controls.
  5. If the dataset is publicly accessible, click on the “X” next to the “allUsers” entry to remove it.
  6. If the dataset is anonymously accessible, click on the “X” next to the “allAuthenticatedUsers” entry to remove it.
  7. If you want to grant access to specific users or groups, click on the “Add item” button and enter their email addresses.
  8. Choose the appropriate access level for the users or groups, such as “Viewer” or “Editor”.
  9. Click on the “Save” button to apply the changes.
  10. Finally, verify that the dataset is no longer publicly or anonymously accessible by reviewing the access controls again.

To remediate the misconfiguration of BigQuery datasets being anonymously or publicly accessible in GCP using GCP CLI, follow these steps:
  1. Open the Cloud Shell from the GCP console.
  2. Run the following command to list all the datasets in your project:
  1. For each dataset that is publicly accessible, run the following command to revoke the public access:
Note: Replace <dataset_id> with the ID of the dataset that you want to remediate.
  1. After running the above command, you will see the following prompt:
  1. Type y and press enter to confirm the update.
  2. Repeat steps 3-5 for all the datasets that are publicly accessible.
  3. Run the following command to verify that the datasets are no longer publicly accessible:
Note: Replace <dataset_id> with the ID of the dataset that you want to verify.
  1. Verify that the defaultTableExpirationMs field is set to -1 in the output. This indicates that the dataset is not publicly accessible.
  2. Repeat step 8 for all the datasets that you have remediated.
By following these steps, you can remediate the misconfiguration of BigQuery datasets being anonymously or publicly accessible in GCP using GCP CLI.
To remediate the misconfiguration of BigQuery datasets being publicly accessible, you can use the following Python code:
  1. First, you need to authenticate and authorize your Python script to access the Google Cloud Platform. For this, you can use the google-auth and google-auth-oauthlib libraries. Here is an example of how to authenticate and authorize:
  1. Once you have authenticated and authorized your script, you can use the google-cloud-bigquery library to access the BigQuery API. Here is an example of how to check if a dataset is publicly accessible:
  1. If the dataset is publicly accessible, you can revoke the public access by removing the READER role for the anonymous user. Here is an example of how to do this:
By following these steps, you can remediate the misconfiguration of BigQuery datasets being publicly accessible in GCP using Python.
Changing only IAM bindings/members does not replace the dataset; it applies in-place. After editing out any allUsers / allAuthenticatedUsers references from all google_bigquery_dataset_iam_* resources, terraform plan should show those principals being removed from the dataset IAM policy and no other changes.

Additional Reading: