turbot/steampipe-mod-terraform-gcp-compliance

Control: Ensure that Cloud Storage bucket is not anonymously or publicly accessible

Description

It is recommended that IAM policy on a Cloud Storage bucket does not allow anonymous or public access.

Usage

Run the control in your terminal:

powerpipe control run terraform_gcp_compliance.control.storage_bucket_not_publicly_accessible

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_gcp_compliance.control.storage_bucket_not_publicly_accessible --share

SQL

This control uses a named query:

select
address as resource,
case
when coalesce(trim((attributes_std ->> 'entity')), '') like any (array ['', '%allAuthenticatedUsers%','%allUsers%'])
then 'alarm'
else 'ok'
end as status,
split_part(address, '.', 2) || case
when coalesce(trim((attributes_std ->> 'entity')), '') = '' then ' ''entity'' is not defined'
when (attributes_std ->> 'entity') like any (array ['%allAuthenticatedUsers%','%allUsers%']) then ' publicly accessible'
else ' not publicly accessible'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type = 'google_storage_bucket_access_control';

Tags