Control: SQS queue policies should not allow ALL (*) principal
Description
Ensure that the SQS queue policy restricts access to specific services or principals, ensuring that it is not publicly accessible.
Usage
Run the control in your terminal:
powerpipe control run terraform_aws_compliance.control.sqs_queue_policy_no_principal_star
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_aws_compliance.control.sqs_queue_policy_no_principal_star --share
SQL
This control uses a named query:
select address as resource, case when ((attributes_std ->> 'policy')::jsonb ) -> 'Statement' @> '[{"Principal": "*"}]' then 'alarm' else 'ok' end as status, split_part(address, '.', 2) || case when ((attributes_std ->> 'policy')::jsonb ) -> 'Statement' @> '[{"Principal": "*"}]' then ' policy allow all principal' else ' policy is ok' end || '.' as reason , path || ':' || start_linefrom terraform_resourcewhere type = 'aws_sqs_queue_policy';