mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-01-25 02:08:11 +00:00
fix(cloudflare): use zone_name as region for DNS records in CheckReportCloudflare
This commit is contained in:
@@ -779,7 +779,10 @@ class CheckReportCloudflare(Check_Report):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def zone_name(self) -> str:
|
def zone_name(self) -> str:
|
||||||
"""Zone name."""
|
"""Zone name - for DNS records use zone_name attribute, for zones use name."""
|
||||||
|
zone_name = getattr(self._zone, "zone_name", None)
|
||||||
|
if zone_name:
|
||||||
|
return zone_name
|
||||||
return getattr(self._zone, "name", "")
|
return getattr(self._zone, "name", "")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -792,7 +795,10 @@ class CheckReportCloudflare(Check_Report):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def region(self) -> str:
|
def region(self) -> str:
|
||||||
"""Cloudflare is a global service."""
|
"""Return zone_name as region for zone-scoped resources, otherwise global."""
|
||||||
|
zone_name = getattr(self._zone, "zone_name", None)
|
||||||
|
if zone_name:
|
||||||
|
return zone_name
|
||||||
return "global"
|
return "global"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -113,6 +113,9 @@ class Test_dns_record_proxied:
|
|||||||
assert result[0].resource_name == "www.example.com"
|
assert result[0].resource_name == "www.example.com"
|
||||||
assert result[0].status == "PASS"
|
assert result[0].status == "PASS"
|
||||||
assert "is proxied through Cloudflare" in result[0].status_extended
|
assert "is proxied through Cloudflare" in result[0].status_extended
|
||||||
|
# DNS records should have zone_name as region
|
||||||
|
assert result[0].region == ZONE_NAME
|
||||||
|
assert result[0].zone_name == ZONE_NAME
|
||||||
|
|
||||||
def test_a_record_not_proxied(self):
|
def test_a_record_not_proxied(self):
|
||||||
dns_client = mock.MagicMock
|
dns_client = mock.MagicMock
|
||||||
|
|||||||
Reference in New Issue
Block a user