Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cloudfront_distribution_use_secure_cipher protocol filter #827

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sbldevnet
Copy link
Contributor

Issue

The query cloudfront_distribution_use_secure_cipher uses a where clause that does not match with resources that should be correct.

From AWS docs allowed values are SSLv3, TLSv1, TLSv1.1 and TLSv1.2. The chosen value is the minimum SSL protocol that CloudFront uses with the origin. The CustomOriginConfig.OriginSslProtocols.Items value will contain all allowed protocols, so choosing SSLv3 will result in ["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"].

Valid origins are those that contain neither SSLv3 nor TLSv1.

CustomOriginConfig.OriginSslProtocols.Items Expected result
["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"] alarm
["TLSv1", "TLSv1.1", "TLSv1.2"] alarm
["TLSv1.1", "TLSv1.2"] ok
["TLSv1.2"] ok

I have added the distinct statement as a distribution using two or more origins, one with SSLv3 and one with TLSv1, would return two results.

Checklist

  • Issue(s) linked

@misraved misraved added the hacktoberfest-accepted This pull request has been accepted for Hacktoberfest label Oct 1, 2024
)
select
b.arn as resource,
distinct b.arn as resource,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ sbldevnet Is this really required as we are using distinct in above CTE origin_protocols. ?

Copy link
Contributor Author

@sbldevnet sbldevnet Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@khushboo9024 when there are two or more origins in the same distribution using the SSLv3 and TLSv1 protocols, the CTE origin_protocols returns the same distribution twice.

As the origin_protocols value is not used in the parent query I think it can be removed from the CTE select to avoid using the distinct in the parent query. I tested it locally and seems to work as expected.

Copy link
Contributor Author

@sbldevnet sbldevnet Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it OK the current fix or should I remove the origin_protocols from the parent query to avoid the distinct? @khushboo9024

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbldevnet I am OK with the current fix. 👍

…b.com:sbldevnet/steampipe-mod-aws-compliance into fix_cloudfront_distribution_use_secure_cipher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted This pull request has been accepted for Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants