turbot/kubernetes_compliance

Query: role_with_wildcards_used

Usage

powerpipe query kubernetes_compliance.query.role_with_wildcards_used

Steampipe Tables

SQL

select
coalesce(uid, concat(path, ':', start_line)) as resource,
case
when rule ->> 'apiGroups' like '%*%'
or rule ->> 'resources' like '%*%'
or rule ->> 'verbs' like '%*%' then 'alarm'
else 'ok'
end as status,
case
when rule ->> 'apiGroups' like '%*%' then name || ' api groups use wildcards.'
when rule ->> 'resources' like '%*%' then name || ' resources use wildcards.'
when rule ->> 'verbs' like '%*%' then name || ' actions use wildcards.'
else name || ' uses no wildcard.'
end as reason,
name as role_name
, coalesce(context_name, '') as context_name, source_type, coalesce(path || ':' || start_line || '-' || end_line, '') as path
from
kubernetes_cluster_role,
jsonb_array_elements(rules) rule
where
name not like '%system%'
group by
uid,
status,
reason,
role_name,
path,
start_line,
end_line,
source_type,
context_name,
tags,
_ctx;

Controls

The query is being used by the following controls: