Skip to content

Commit

Permalink
fix: Correctly Handle nil values in Cloudfront Check (#795)
Browse files Browse the repository at this point in the history
* Update distribution_should_encrypt_traffic_to_custom_origins.sql

* Update distribution_should_encrypt_traffic_to_custom_origins.sql

* Update distribution_should_encrypt_traffic_to_custom_origins.sql

* Update distribution_should_encrypt_traffic_to_custom_origins.sql
  • Loading branch information
bbernays authored Apr 19, 2024
1 parent d305f63 commit efdcd2d
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ cache_behaviors as (
arn
from
aws_cloudfront_distributions d,
JSONB_ARRAY_ELEMENTS(COALESCE(distribution_config -> 'CacheBehaviors' -> 'Items', '{}')) as f
JSONB_ARRAY_ELEMENTS(
case
when distribution_config ->> 'CacheBehaviors' is NULL then '[]'::jsonb
when (distribution_config -> 'CacheBehaviors') ->> 'Items' is NULL then '[]'::jsonb
else COALESCE((distribution_config -> 'CacheBehaviors') -> 'Items', '[]'::jsonb)
end
) as f
where
f ->> 'ViewerProtocolPolicy' = 'allow-all'
)
Expand Down

0 comments on commit efdcd2d

Please sign in to comment.