turbot/steampipe-mod-gcp-compliance

Control: Ensure API keys are rotated every 90 days

Description

It is recommended to rotate API keys every 90 days.

Usage

Run the control in your terminal:

powerpipe control run gcp_compliance.control.iam_api_key_age_90

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run gcp_compliance.control.iam_api_key_age_90 --share

SQL

This control uses a named query:

select
'https://iam.googleapis.com/v1/projects/' || project || '/apikeys/' || name as resource,
case
when create_time <= (current_date - interval '90' day) then 'alarm'
else 'ok'
end as status,
display_name || ' ' || uid || ' created ' || to_char(create_time , 'DD-Mon-YYYY') ||
' (' || extract(day from current_timestamp - create_time) || ' days).'
as reason
, project as project
from
gcp_apikeys_key;

Tags