Skip to content

Commit

Permalink
fix(asff): include status extended in ASFF output (#5097)
Browse files Browse the repository at this point in the history
(cherry picked from commit 45ce1a0)
  • Loading branch information
sergargar committed Sep 20, 2024
1 parent feae73a commit 1faf027
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion prowler/lib/outputs/asff/asff.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ def transform(self, findings: list[Finding]) -> None:
CreatedAt=timestamp,
Severity=Severity(Label=finding.severity.value),
Title=finding.check_title,
Description=finding.description,
Description=(
(finding.status_extended[:1000] + "...")
if len(finding.status_extended) > 1000
else finding.status_extended
),
Resources=[
Resource(
Id=finding.resource_uid,
Expand Down
12 changes: 6 additions & 6 deletions tests/lib/outputs/asff/asff_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_asff(self):
Url=finding.remediation_recommendation_url,
)
),
Description=finding.description,
Description=finding.status_extended,
)

asff = ASFF(findings=[finding])
Expand Down Expand Up @@ -150,7 +150,7 @@ def test_asff_without_remediation_recommendation_url(self):
Url="https://docs.aws.amazon.com/securityhub/latest/userguide/what-is-securityhub.html",
)
),
Description=finding.description,
Description=finding.status_extended,
)

asff = ASFF(findings=[finding])
Expand Down Expand Up @@ -215,7 +215,7 @@ def test_asff_without_resource_tags(self):
Url="https://docs.aws.amazon.com/securityhub/latest/userguide/what-is-securityhub.html",
)
),
Description=finding.description,
Description=finding.status_extended,
)

asff = ASFF(findings=[finding])
Expand Down Expand Up @@ -284,7 +284,7 @@ def test_asff_with_long_description_and_remediation_recommendation_text(
Url="https://docs.aws.amazon.com/securityhub/latest/userguide/what-is-securityhub.html",
)
),
Description=finding.description,
Description=finding.status_extended,
)

asff = ASFF(findings=[finding])
Expand Down Expand Up @@ -491,7 +491,7 @@ def test_fill_json_asff_with_long_associated_standards(self):
Url=finding.remediation_recommendation_url,
)
),
Description=finding.description,
Description=finding.status_extended,
)

asff = ASFF(findings=[finding])
Expand Down Expand Up @@ -538,7 +538,7 @@ def test_asff_write_to_file(self):
"CreatedAt": timestamp,
"Severity": {"Label": "HIGH"},
"Title": "test-check-id",
"Description": "check description",
"Description": "This is a test",
"Resources": [
{
"Type": "test-resource",
Expand Down

0 comments on commit 1faf027

Please sign in to comment.