Broad authenticated-user access to a GCP BigQuery dataset

Limit dataset access to the users and service accounts that need it.

Description

BigQuery’s allAuthenticatedUsers includes users signed in with Google Accounts and service accounts outside your organization. Anonymous users are excluded. The dataset role determines which operations are allowed.

Potential impact

Read access can expose data outside your organization. Write or administrative roles can also allow users to alter data or access controls.

Remediation

Check whether publication is intended. For internal datasets, remove unnecessary allAuthenticatedUsers grants, assign the minimum roles to approved users, groups or service accounts, and review inherited IAM permissions. Test that approved access succeeds and unapproved requests are denied.

Examples

Both examples manage the same dataset. Define the referenced bqowner service account separately.

Before

hcl
resource "google_bigquery_dataset" "analytics_dataset" {
  dataset_id = "example_dataset"
  location   = "EU"

  access {
    role          = "OWNER"
    special_group = "allAuthenticatedUsers"
  }
}

The OWNER role gives dataset administration privileges to the entire authenticated group.

After

hcl
resource "google_bigquery_dataset" "analytics_dataset" {
  dataset_id = "example_dataset"
  location   = "EU"

  access {
    role          = "OWNER"
    user_by_email = google_service_account.bqowner.email
  }
}

Only google_service_account.bqowner.email keeps the grant, but its role is still OWNER. Use a narrower role unless this account needs to administer the dataset.

References