fix(gcp): set always location to lowercase (#2970)

This commit is contained in:
Sergio Garcia
2023-10-26 13:21:09 +02:00
committed by GitHub
parent 55ebadfe28
commit 3ca38fe92d
5 changed files with 6 additions and 6 deletions

View File

@@ -136,7 +136,7 @@ def fill_compliance(output_options, finding, audit_info, file_descriptors):
Provider=finding.check_metadata.Provider,
Description=compliance.Description,
ProjectId=finding.project_id,
Location=finding.location,
Location=finding.location.lower(),
AssessmentDate=outputs_unix_timestamp(
output_options.unix_timestamp, timestamp
),

View File

@@ -181,7 +181,7 @@ def fill_html(file_descriptor, finding, output_options):
<td>{finding.status}</td>
<td>{finding.check_metadata.Severity}</td>
<td>{finding.check_metadata.ServiceName}</td>
<td>{finding.location if isinstance(finding, Check_Report_GCP) else finding.region if isinstance(finding, Check_Report_AWS) else ""}</td>
<td>{finding.location.lower() if isinstance(finding, Check_Report_GCP) else finding.region if isinstance(finding, Check_Report_AWS) else ""}</td>
<td>{finding.check_metadata.CheckID.replace("_", "<wbr>_")}</td>
<td>{finding.check_metadata.CheckTitle}</td>
<td>{finding.resource_id.replace("<", "&lt;").replace(">", "&gt;").replace("_", "<wbr>_")}</td>

View File

@@ -188,7 +188,7 @@ def fill_json_ocsf(audit_info, finding, output_options) -> Check_Output_JSON_OCS
finding_uid = f"prowler-{finding.check_metadata.Provider}-{finding.check_metadata.CheckID}-{finding.subscription}-{finding.resource_id}"
elif finding.check_metadata.Provider == "gcp":
project_uid = finding.project_id
resource_region = finding.location
resource_region = finding.location.lower()
resource_name = finding.resource_name
resource_uid = finding.resource_id
finding_uid = f"prowler-{finding.check_metadata.Provider}-{finding.check_metadata.CheckID}-{finding.project_id}-{finding.resource_id}"

View File

@@ -67,7 +67,7 @@ def generate_provider_output_csv(
data["resource_id"] = finding.resource_id
data["resource_name"] = finding.resource_name
data["project_id"] = finding.project_id
data["location"] = finding.location
data["location"] = finding.location.lower()
data[
"finding_unique_id"
] = f"prowler-{provider}-{finding.check_metadata.CheckID}-{finding.project_id}-{finding.resource_id}"
@@ -380,7 +380,7 @@ def generate_provider_output_json(
if provider == "gcp":
finding_output.ProjectId = finding.project_id
finding_output.Location = finding.location
finding_output.Location = finding.location.lower()
finding_output.ResourceId = finding.resource_id
finding_output.ResourceName = finding.resource_name
finding_output.FindingUniqueId = f"prowler-{provider}-{finding.check_metadata.CheckID}-{finding.project_id}-{finding.resource_id}"

View File

@@ -25,7 +25,7 @@ def stdout_report(finding, color, verbose, is_quiet):
if finding.check_metadata.Provider == "azure":
details = finding.check_metadata.ServiceName
if finding.check_metadata.Provider == "gcp":
details = finding.location
details = finding.location.lower()
if verbose and not (is_quiet and finding.status != "FAIL"):
print(