Skip to content

Commit

Permalink
chore: change check name
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCloudSec committed Sep 12, 2024
1 parent 4b5487f commit d7dbd94
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"Provider": "aws",
"CheckID": "cloudfront_distributions_custom_origin_traffic_encrypted",
"CheckID": "cloudfront_distributions_origin_traffic_encrypted",
"CheckTitle": "Check if CloudFront distributions encrypt traffic to custom origins.",
"CheckType": [
"NIST 800-53 Controls"
],
"CheckType": [],
"ServiceName": "cloudfront",
"SubServiceName": "",
"ResourceIdTemplate": "arn:partition:cloudfront:region:account-id:distribution/resource-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
)


class cloudfront_distributions_custom_origin_traffic_encrypted(Check):
class cloudfront_distributions_origin_traffic_encrypted(Check):
def execute(self):
findings = []
for distribution in cloudfront_client.distributions.values():
Expand All @@ -14,7 +14,7 @@ def execute(self):
report.resource_id = distribution.id
report.resource_tags = distribution.tags
report.status = "PASS"
report.status_extended = f"CloudFront Distribution {distribution.id} does encrypt traffic to custom origins."
report.status_extended = f"CloudFront Distribution {distribution.id} does encrypt traffic to custom origins."

for origin in distribution.origins:
if (
Expand All @@ -25,7 +25,7 @@ def execute(self):
and distribution.viewer_protocol_policy == "allow-all"
):
report.status = "FAIL"
report.status_extended = f"CloudFront Distribution {distribution.id} does not encrypt traffic to custom origins."
report.status_extended = f"CloudFront Distribution {distribution.id} does not encrypt traffic to custom origins."

findings.append(report)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
REGION = "eu-west-1"


class Test_cloudfront_distributions_custom_origin_traffic_encrypted:
class Test_cloudfront_distributions_origin_traffic_encrypted:
def test_no_distributions(self):
cloudfront_client = mock.MagicMock
cloudfront_client.distributions = {}
Expand All @@ -24,11 +24,11 @@ def test_no_distributions(self):
new=cloudfront_client,
):
# Test Check
from prowler.providers.aws.services.cloudfront.cloudfront_distributions_custom_origin_traffic_encrypted.cloudfront_distributions_custom_origin_traffic_encrypted import (
cloudfront_distributions_custom_origin_traffic_encrypted,
from prowler.providers.aws.services.cloudfront.cloudfront_distributions_origin_traffic_encrypted.cloudfront_distributions_origin_traffic_encrypted import (
cloudfront_distributions_origin_traffic_encrypted,
)

check = cloudfront_distributions_custom_origin_traffic_encrypted()
check = cloudfront_distributions_origin_traffic_encrypted()
result = check.execute()

assert len(result) == 0
Expand Down Expand Up @@ -63,11 +63,11 @@ def test_distribution_no_traffic_encryption(self):
new=cloudfront_client,
):
# Test Check
from prowler.providers.aws.services.cloudfront.cloudfront_distributions_custom_origin_traffic_encrypted.cloudfront_distributions_custom_origin_traffic_encrypted import (
cloudfront_distributions_custom_origin_traffic_encrypted,
from prowler.providers.aws.services.cloudfront.cloudfront_distributions_origin_traffic_encrypted.cloudfront_distributions_origin_traffic_encrypted import (
cloudfront_distributions_origin_traffic_encrypted,
)

check = cloudfront_distributions_custom_origin_traffic_encrypted()
check = cloudfront_distributions_origin_traffic_encrypted()
result = check.execute()

assert len(result) == 1
Expand Down Expand Up @@ -110,11 +110,11 @@ def test_distribution_http_only(self):
new=cloudfront_client,
):
# Test Check
from prowler.providers.aws.services.cloudfront.cloudfront_distributions_custom_origin_traffic_encrypted.cloudfront_distributions_custom_origin_traffic_encrypted import (
cloudfront_distributions_custom_origin_traffic_encrypted,
from prowler.providers.aws.services.cloudfront.cloudfront_distributions_origin_traffic_encrypted.cloudfront_distributions_origin_traffic_encrypted import (
cloudfront_distributions_origin_traffic_encrypted,
)

check = cloudfront_distributions_custom_origin_traffic_encrypted()
check = cloudfront_distributions_origin_traffic_encrypted()
result = check.execute()

assert len(result) == 1
Expand Down Expand Up @@ -158,11 +158,11 @@ def test_distribution_match_viewer_allow_all(self):
new=cloudfront_client,
):
# Test Check
from prowler.providers.aws.services.cloudfront.cloudfront_distributions_custom_origin_traffic_encrypted.cloudfront_distributions_custom_origin_traffic_encrypted import (
cloudfront_distributions_custom_origin_traffic_encrypted,
from prowler.providers.aws.services.cloudfront.cloudfront_distributions_origin_traffic_encrypted.cloudfront_distributions_origin_traffic_encrypted import (
cloudfront_distributions_origin_traffic_encrypted,
)

check = cloudfront_distributions_custom_origin_traffic_encrypted()
check = cloudfront_distributions_origin_traffic_encrypted()
result = check.execute()

assert len(result) == 1
Expand Down Expand Up @@ -205,11 +205,11 @@ def test_distribution_traffic_encrypted(self):
new=cloudfront_client,
):
# Test Check
from prowler.providers.aws.services.cloudfront.cloudfront_distributions_custom_origin_traffic_encrypted.cloudfront_distributions_custom_origin_traffic_encrypted import (
cloudfront_distributions_custom_origin_traffic_encrypted,
from prowler.providers.aws.services.cloudfront.cloudfront_distributions_origin_traffic_encrypted.cloudfront_distributions_origin_traffic_encrypted import (
cloudfront_distributions_origin_traffic_encrypted,
)

check = cloudfront_distributions_custom_origin_traffic_encrypted()
check = cloudfront_distributions_origin_traffic_encrypted()
result = check.execute()

assert len(result) == 1
Expand Down

0 comments on commit d7dbd94

Please sign in to comment.