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 basic parser for Outpost24 scan format #1750

Merged
merged 9 commits into from Jan 30, 2020
Merged

Add basic parser for Outpost24 scan format #1750

merged 9 commits into from Jan 30, 2020

Conversation

jvz
Copy link
Contributor

@jvz jvz commented Jan 9, 2020

@madchap @jeffret-b @Wadeck @daniel-beck

When submitting a pull request, please make sure you have completed the following checklist:

  • Your code is flake8 compliant
  • Your code is python 3.5 compliant
  • If this is a new feature and not a bug fix, you've included the proper documentation in the ReadTheDocs documentation folder. https://github.com/DefectDojo/Documentation/tree/master/docs or provide feature documentation in the PR.
  • Model changes must include the necessary migrations in the dojo/dd_migrations folder.
  • Add applicable tests to the unit tests.

@Maffooch
Copy link
Contributor

Don't forget about adding the fixture :)

Copy link
Collaborator

@madchap madchap left a comment

Choose a reason for hiding this comment

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

@jvz test_type.json fixture that is ;-)

Also, additional couple tests for 1 finding and 0 finding to follow on what is being done today. The travis build is failing because of flake8, make sure you double-check on that.

Cheers!
fred

Signed-off-by: Matt Sicker <boards@gmail.com>
Signed-off-by: Matt Sicker <boards@gmail.com>
Signed-off-by: Matt Sicker <boards@gmail.com>
@jvz
Copy link
Contributor Author

jvz commented Jan 13, 2020

Alright, I've addressed those issues. There's still a little bit of code to add for the endpoints part, though I'll follow up with that later today. Let's make sure this part passes CI at least.

Signed-off-by: Matt Sicker <boards@gmail.com>
@jvz jvz requested a review from madchap January 13, 2020 20:15
@jvz
Copy link
Contributor Author

jvz commented Jan 14, 2020

Seems to be a test failure still. I'll update later today.

Signed-off-by: Matt Sicker <boards@gmail.com>
@jvz
Copy link
Contributor Author

jvz commented Jan 14, 2020

Figured it out. @jeffret-b feel free to review now!

Copy link

@jeffret-b jeffret-b left a comment

Choose a reason for hiding this comment

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

It will be nice to have a parser for this format to import findings when there is a need. I don't have a lot of experience in DefectDojo code, but the proposed changes here all look clean and correct.

from dojo.models import Test


class TestOutpost24Parser(TestCase):

Choose a reason for hiding this comment

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

Does it make sense to have at least one test that check the finding details?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You'd think so, but I didn't see any other tests doing that. 🤷‍♂

Choose a reason for hiding this comment

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

I agree that it doesn't seem to be common in these tests, so maybe it isn't valuable. I did find this example, though, that is doing something along those lines:

def check_parse_file_with_single_vulnerability_has_single_finding(self, parser):

@jeffret-b
Copy link

Remaining to be done before merge

@jvz is this comment in other original description still accurate? Is there still remaining work to be done?

Copy link
Collaborator

@madchap madchap left a comment

Choose a reason for hiding this comment

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

I think the parsing could add a few items.

For example, the CVSS scores (probably both 2 and 3) and vectors could be added to the "Severity justification" field in DD. Also the <cvss_vector_description> could also be added or eventually appended to the overall description.

Also, the "References" field could eventually benefit from info in the <referencelist>.

What do you think?

@jvz jvz requested a review from madchap January 22, 2020 19:39
@jvz
Copy link
Contributor Author

jvz commented Jan 22, 2020

When you merge this, please squash the history. Thanks!

Copy link
Collaborator

@madchap madchap left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for making these changes!

@madchap
Copy link
Collaborator

madchap commented Jan 27, 2020

@jvz if you could upload that sample file as well in the sibling repo at https://github.com/DefectDojo/sample-scan-files, it would be great. Thanks!

@ptrovatelli
Copy link
Collaborator

ptrovatelli commented Jan 27, 2020

looks pretty neat.
was this sample.xml file manually modified? there are a lot of duplicates for example <id>1377090</id> appearing twice with just firstseen changed
if this is a regular report, it might be good to do some aggregation upon import; it'll greatly improve the performances by inserted much less lines into the db and also will make the analysis easier (or maybe just ignore part of the report if we can find that some part is duplicate with another part)

dependency check amongst other scanners do this, using a dict. ideally update nb_occurences in that case.

it might be nice to use that falsepositive flag too to fill in the according field in the db

@jvz
Copy link
Contributor Author

jvz commented Jan 29, 2020

was this sample.xml file manually modified? there are a lot of duplicates for example <id>1377090</id> appearing twice with just firstseen changed

Yes, I started from a real scan, removed several things, and didn't really update any summary statistics at the top as I wasn't sure how they're calculated by the tool itself. I'm not sure exactly what the id element corresponds to, but it's a tool-specific id.

@madchap madchap merged commit b62307a into DefectDojo:dev Jan 30, 2020
@jvz jvz deleted the op24 branch February 5, 2020 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants