Control: CloudFront response header policy should be configured with Strict Transport Security
Description
This control checks whether CloudFront response header policy enforces Strict Transport Security.
Usage
Run the control in your terminal:
powerpipe control run terraform_aws_compliance.control.cloudfront_response_header_use_strict_transport_policy_setting
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_aws_compliance.control.cloudfront_response_header_use_strict_transport_policy_setting --share
SQL
This control uses a named query:
select address as resource, case when (attributes_std -> 'security_headers_config' -> 'strict_transport_security' ->> 'access_control_max_age_sec')::integer = 31536000 and (attributes_std -> 'security_headers_config' -> 'strict_transport_security' ->> 'include_subdomains')::boolean and (attributes_std -> 'security_headers_config' -> 'strict_transport_security' ->> 'preload')::boolean and (attributes_std -> 'security_headers_config' -> 'strict_transport_security' ->> 'override')::boolean then 'ok' else 'alarm' end status, split_part(address, '.', 2) || case when (attributes_std -> 'security_headers_config' -> 'strict_transport_security' ->> 'access_control_max_age_sec')::integer = 31536000 and (attributes_std -> 'security_headers_config' -> 'strict_transport_security' ->> 'include_subdomains')::boolean and (attributes_std -> 'security_headers_config' -> 'strict_transport_security' ->> 'preload')::boolean and (attributes_std -> 'security_headers_config' -> 'strict_transport_security' ->> 'override')::boolean then ' enforces Strict Transport Security settings' else ' does not enforce Strict Transport Security settings' end || '.' as reason , path || ':' || start_linefrom terraform_resourcewhere type = 'aws_cloudfront_response_headers_policy';