fix(security-hub): MUTED -> WARNING (#3768)

This commit is contained in:
Pepe Fagoaga
2024-04-15 09:58:18 +02:00
committed by GitHub
parent 49e238577c
commit f8476decf7
4 changed files with 5 additions and 3 deletions
+1
View File
@@ -330,6 +330,7 @@ Detailed documentation at https://docs.prowler.com
"--mutelist-file",
"-w",
nargs="?",
# TODO(PRWLR-3519): this has to be done in the provider class not here
default=get_default_mute_file_path(provider),
help="Path for mutelist yaml file. See example prowler/config/<provider>_mutelist.yaml for reference and format. For AWS provider, it also accepts AWS DynamoDB Table, Lambda ARNs or S3 URIs, see more in https://docs.prowler.cloud/en/latest/tutorials/mutelist/",
)
+3 -1
View File
@@ -16,7 +16,9 @@ from prowler.lib.utils.utils import hash_sha512
def generate_json_asff_status(status: str, muted: bool = False) -> str:
json_asff_status = ""
if muted:
json_asff_status = "MUTED"
# Per AWS Security Hub "MUTED" is not a valid status
# https://docs.aws.amazon.com/securityhub/1.0/APIReference/API_Compliance.html
json_asff_status = "WARNING"
else:
if status == "PASS":
json_asff_status = "PASSED"
@@ -196,7 +196,6 @@ def __send_findings_to_security_hub__(
for findings in list_chunked:
batch_import = security_hub_client.batch_import_findings(Findings=findings)
if batch_import["FailedCount"] > 0:
print(batch_import["FailedCount"])
failed_import = batch_import["FailedFindings"][0]
logger.error(
f"Failed to send findings to AWS Security Hub -- {failed_import['ErrorCode']} -- {failed_import['ErrorMessage']}"
@@ -457,7 +457,7 @@ class TestOutputJSONASFF:
def test_generate_json_asff_status(self):
assert generate_json_asff_status("PASS") == "PASSED"
assert generate_json_asff_status("FAIL") == "FAILED"
assert generate_json_asff_status("FAIL", True) == "MUTED"
assert generate_json_asff_status("FAIL", True) == "WARNING"
assert generate_json_asff_status("SOMETHING ELSE") == "NOT_AVAILABLE"
def test_generate_json_asff_resource_tags(self):