-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(ASFF): create class #4368
refactor(ASFF): create class #4368
Conversation
@@ -39,6 +39,7 @@ def batch_write_data_to_file(self) -> None: | |||
csv_writer.writeheader() | |||
for finding in self._data: | |||
csv_writer.writerow(finding) | |||
self._file_descriptor.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to the CSV class since it was missing.
@@ -30,7 +30,7 @@ def transform(self, findings: list[Finding]) -> None: | |||
def batch_write_data_to_file(self) -> None: | |||
"""Writes the findings to a file using the CSV format using the `Output._file_descriptor`.""" | |||
try: | |||
if self._file_descriptor: | |||
if self._file_descriptor and not self._file_descriptor.closed: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to check that the file descriptor is not closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to the the asff.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to the the asff.py
elif output_mode == "json-asff": | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? As compliance does not use it, I think we can remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is needed for now until we solve Compliance, am I right @pedrooot ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when all the output PRs are merged we can delete all the ifs and maintain only the specifics for compliance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think that this can be removed, this output_mode
is not used in compliance...
Tested locally and it perfectly works! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4368 +/- ##
==========================================
- Coverage 87.56% 87.39% -0.17%
==========================================
Files 852 851 -1
Lines 26592 26618 +26
==========================================
- Hits 23284 23262 -22
- Misses 3308 3356 +48 ☔ View full report in Codecov by Sentry. |
Now, |
The final approach it's that all the findings passed to |
…4023-generate-the-asff-output-object-from-a-list-of-findings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context
We are creating modular outputs for Prowler, now is the time for the AWS Security Finding Format.
Description
ASFF(Output)
class.filter_security_hub_findings_per_region
since now we don't need to recreate the ASFF findings, we've been doing it twice 🤦License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.