Skip to content
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

Add sarif conversion to Nessus postprocess() #261

Merged
merged 9 commits into from
Nov 26, 2024

Conversation

jpweiser
Copy link
Collaborator

No description provided.

@@ -12,6 +15,7 @@
from configmodel import RapidastConfigModel
from scanners import RapidastScanner
from scanners import State
from scanners.generic.tools.convert_nessus_csv_to_sarif import convert_csv_to_sarif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should have asked for this in last PR, but could you add a basic test for this function, you might find examples in tests/scanners/generic/tools/test_convert_trivy_k8s.py helpful

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on this now. Reviewing the directory structure a bit more, does it make more sense to move the convert_nessus_csv_to_sarif file to something like scanners/nessus/tools instead of the generic directory where it is currently located as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests added. Went ahead and did that move, which can obviously be undone.

The linter is unhappy, but I believe it is only the Nessus CSV file formatting it takes issue with

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gah that's annoying. Try adding this patch to exclude CSV files from this check:

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 8408bc9..878ab3e 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -4,6 +4,7 @@ repos:
     hooks:
       - id: trailing-whitespace
         language_version: python3
+        exclude: \.csv$
       - id: end-of-file-fixer
       - id: debug-statements
         language_version: python3

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That worked! Thanks!

scanners/nessus/nessus_none.py Outdated Show resolved Hide resolved
scanners/nessus/nessus_none.py Outdated Show resolved Hide resolved
@jpweiser jpweiser marked this pull request as ready for review November 25, 2024 20:25
@jpweiser jpweiser requested a review from a team as a code owner November 25, 2024 20:25
Copy link
Collaborator

@sfowl sfowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The suggested patch should solve the linting issue

@sfowl sfowl merged commit d6e2122 into RedHatProductSecurity:development Nov 26, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants