turbot/terraform_gcp_compliance

Query: bigquery_dataset_not_publicly_accessible

Usage

powerpipe query terraform_gcp_compliance.query.bigquery_dataset_not_publicly_accessible

Steampipe Tables

SQL

select
address as resource,
case
when (attributes_std -> 'access') is null then 'ok'
when exists(
select
1
from
jsonb_array_elements(
case
when jsonb_typeof(attributes_std -> 'access') = 'array' then attributes_std -> 'access'
else jsonb_build_array(attributes_std -> 'access')
end
) as access
where
(access ->> 'special_group' is not null and access ->> 'special_group' in ('allAuthenticatedUsers', 'allUsers'))
or
not(access ?| ARRAY['user_by_email', 'group_by_email', 'domain', 'view', 'routine', 'dataset'])
) then 'alarm'
else 'ok'
end status,
split_part(address, '.', 2) || case
when (attributes_std -> 'access') is null then 'ok'
when exists(
select
1
from
jsonb_array_elements(attributes_std -> 'access') as access
where
(access ->> 'special_group' is not null and access ->> 'special_group' in ('allAuthenticatedUsers', 'allUsers'))
or
not(access ?| ARRAY['user_by_email', 'group_by_email', 'domain', 'view', 'routine', 'dataset'])
) then 'alarm'
else 'ok'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type = 'google_bigquery_dataset';

Controls

The query is being used by the following controls: