Skip to content

Commit fcf8176

Browse files
pedroootMrCloudSec
andauthored
feat(compliance): add c5 azure base (#9081)
Co-authored-by: Sergio Garcia <hello@mistercloudsec.com>
1 parent cad97f2 commit fcf8176

File tree

8 files changed

+9651
-1
lines changed

8 files changed

+9651
-1
lines changed

api/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ All notable changes to the **Prowler API** are documented in this file.
88
- Extend `GET /api/v1/providers` with provider-type filters and optional pagination disable to support the new Overview filters [(#8975)](https://github.com/prowler-cloud/prowler/pull/8975)
99
- New endpoint to retrieve the number of providers grouped by provider type [(#8975)](https://github.com/prowler-cloud/prowler/pull/8975)
1010
- Support for configuring multiple LLM providers [(#8772)](https://github.com/prowler-cloud/prowler/pull/8772)
11+
- Support C5 compliance framework for Azure provider [(#9081)](https://github.com/prowler-cloud/prowler/pull/9081)
1112
- Support for Oracle Cloud Infrastructure (OCI) provider [(#8927)](https://github.com/prowler-cloud/prowler/pull/8927)
1213

1314
## [1.14.1] (Prowler 5.13.1)

api/src/backend/tasks/jobs/export.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
AWSWellArchitected,
2222
)
2323
from prowler.lib.outputs.compliance.c5.c5_aws import AWSC5
24+
from prowler.lib.outputs.compliance.c5.c5_azure import AzureC5
2425
from prowler.lib.outputs.compliance.ccc.ccc_aws import CCC_AWS
2526
from prowler.lib.outputs.compliance.ccc.ccc_azure import CCC_Azure
2627
from prowler.lib.outputs.compliance.ccc.ccc_gcp import CCC_GCP
@@ -88,6 +89,7 @@
8889
(lambda name: name.startswith("iso27001_"), AzureISO27001),
8990
(lambda name: name == "ccc_azure", CCC_Azure),
9091
(lambda name: name == "prowler_threatscore_azure", ProwlerThreatScoreAzure),
92+
(lambda name: name == "c5_azure", AzureC5),
9193
],
9294
"gcp": [
9395
(lambda name: name.startswith("cis_"), GCPCIS),

dashboard/compliance/c5_azure.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import warnings
2+
3+
from dashboard.common_methods import get_section_containers_3_levels
4+
5+
warnings.filterwarnings("ignore")
6+
7+
8+
def get_table(data):
9+
data["REQUIREMENTS_DESCRIPTION"] = (
10+
data["REQUIREMENTS_ID"] + " - " + data["REQUIREMENTS_DESCRIPTION"]
11+
)
12+
13+
data["REQUIREMENTS_DESCRIPTION"] = data["REQUIREMENTS_DESCRIPTION"].apply(
14+
lambda x: x[:150] + "..." if len(str(x)) > 150 else x
15+
)
16+
17+
data["REQUIREMENTS_ATTRIBUTES_SECTION"] = data[
18+
"REQUIREMENTS_ATTRIBUTES_SECTION"
19+
].apply(lambda x: x[:80] + "..." if len(str(x)) > 80 else x)
20+
21+
data["REQUIREMENTS_ATTRIBUTES_SUBSECTION"] = data[
22+
"REQUIREMENTS_ATTRIBUTES_SUBSECTION"
23+
].apply(lambda x: x[:150] + "..." if len(str(x)) > 150 else x)
24+
25+
aux = data[
26+
[
27+
"REQUIREMENTS_DESCRIPTION",
28+
"REQUIREMENTS_ATTRIBUTES_SECTION",
29+
"REQUIREMENTS_ATTRIBUTES_SUBSECTION",
30+
"CHECKID",
31+
"STATUS",
32+
"REGION",
33+
"ACCOUNTID",
34+
"RESOURCEID",
35+
]
36+
]
37+
38+
return get_section_containers_3_levels(
39+
aux,
40+
"REQUIREMENTS_ATTRIBUTES_SECTION",
41+
"REQUIREMENTS_ATTRIBUTES_SUBSECTION",
42+
"REQUIREMENTS_DESCRIPTION",
43+
)

prowler/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ All notable changes to the **Prowler SDK** are documented in this file.
1414
### Changed
1515
- Update AWS Direct Connect service metadata to new format [(#8855)](https://github.com/prowler-cloud/prowler/pull/8855)
1616
- Update AWS DRS service metadata to new format [(#8870)](https://github.com/prowler-cloud/prowler/pull/8870)
17+
- C5 compliance framework for Azure provider [(#9081)](https://github.com/prowler-cloud/prowler/pull/9081)
1718
- Update AWS DynamoDB service metadata to new format [(#8871)](https://github.com/prowler-cloud/prowler/pull/8871)
1819
- Update AWS EMR service metadata to new format [(#9002)](https://github.com/prowler-cloud/prowler/pull/9002)
1920
- Update AWS EKS service metadata to new format [(#8890)](https://github.com/prowler-cloud/prowler/pull/8890)

prowler/__main__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@
4949
from prowler.lib.outputs.compliance.aws_well_architected.aws_well_architected import (
5050
AWSWellArchitected,
5151
)
52+
from prowler.lib.outputs.compliance.c5.c5_aws import AWSC5
53+
from prowler.lib.outputs.compliance.c5.c5_azure import AzureC5
5254
from prowler.lib.outputs.compliance.ccc.ccc_aws import CCC_AWS
5355
from prowler.lib.outputs.compliance.ccc.ccc_azure import CCC_Azure
5456
from prowler.lib.outputs.compliance.ccc.ccc_gcp import CCC_GCP
55-
from prowler.lib.outputs.compliance.c5.c5_aws import AWSC5
5657
from prowler.lib.outputs.compliance.cis.cis_aws import AWSCIS
5758
from prowler.lib.outputs.compliance.cis.cis_azure import AzureCIS
5859
from prowler.lib.outputs.compliance.cis.cis_gcp import GCPCIS
@@ -682,6 +683,18 @@ def streaming_callback(findings_batch):
682683
)
683684
generated_outputs["compliance"].append(ccc_azure)
684685
ccc_azure.batch_write_data_to_file()
686+
elif compliance_name == "c5_azure":
687+
filename = (
688+
f"{output_options.output_directory}/compliance/"
689+
f"{output_options.output_filename}_{compliance_name}.csv"
690+
)
691+
c5_azure = AzureC5(
692+
findings=finding_outputs,
693+
compliance=bulk_compliance_frameworks[compliance_name],
694+
file_path=filename,
695+
)
696+
generated_outputs["compliance"].append(c5_azure)
697+
c5_azure.batch_write_data_to_file()
685698
else:
686699
filename = (
687700
f"{output_options.output_directory}/compliance/"

0 commit comments

Comments
 (0)