Skip to content

Snyk parser enhancements - #3616

Merged
valentijnscholten merged 11 commits into
devfrom
unknown repository
Jan 16, 2021
Merged

valentijnscholten merged 11 commits into
devfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Jan 12, 2021 •

Copy link
Copy Markdown

This PR addresses the following features:

  • Support for Snyk JSON reports generated with the --all-projects (e.g: Maven multi module projects).

  • Added the following missing fields for each Finding generated from a report:

    • CVSS3
    • Severity justification
    • Mitigation
    • References
  • Minor visual changes:

    • Added link to the Snyk Vulnerability Database for the referenced Snyk IDs.
    • Added bold format to the details section within the issue description.

TODO:

  • Add unit test

@valentijnscholten

Copy link
Copy Markdown
Member

Hi, Can you provide sample scans for these new features? Can you set component_name and component_version fields?

@ghost

ghost commented Jan 12, 2021

Copy link
Copy Markdown
Author

Hi, Can you provide sample scans for these new features? Can you set component_name and component_version fields?

Hi @valentijnscholten , I have generated two sample files you can find it here

What do you mean by set component_name and component_version fields?
I think the value that is currently being assigned may be correct.

Regards.

@valentijnscholten

Copy link
Copy Markdown
Member

I meant can you extend the unit tests to use samples with the new features.

And sorry, didn't notice that component_name/version are already set correctly :-)

@ghost

ghost commented Jan 13, 2021

Copy link
Copy Markdown
Author

I meant can you extend the unit tests to use samples with the new features.

And sorry, didn't notice that component_name/version are already set correctly :-)

Hi @valentijnscholten,
Merged #3615 into this pr to take those fixes into account for the unit tests.

Regards,

@damiencarol damiencarol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Avoid adding HTML formatting in Finding attributes. If you want to have some formatting use Markdown syntax.

Comment thread dojo/tools/snyk/parser.py Resolved
Comment thread dojo/tools/snyk/parser.py Resolved
Comment thread dojo/tools/snyk/parser.py Resolved
Comment thread dojo/tools/snyk/parser.py Resolved

@damiencarol damiencarol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is one last thing that could be done.
cwe attribute of findings are integer. depending on the data the parser return an integer or a string.

Could you improve a little bit your pull request to manage this?

Some conversion in integer is required in this part I think:
https://github.com/DefectDojo/django-DefectDojo/blob/master/dojo/tools/snyk/parser.py#L65-L73

Comment thread dojo/unittests/test_snyk_parser.py Resolved
@damiencarol damiencarol self-assigned this Jan 14, 2021
@ghost

ghost commented Jan 14, 2021

Copy link
Copy Markdown
Author

There is one last thing that could be done.
cwe attribute of findings are integer. depending on the data the parser return an integer or a string.

Could you improve a little bit your pull request to manage this?

Some conversion in integer is required in this part I think:
https://github.com/DefectDojo/django-DefectDojo/blob/master/dojo/tools/snyk/parser.py#L65-L73

Hi @damiencarol ,

Made a refactor for the CWE parsing addressing the following points:

  • Parse CWE as an integer
  • Change JSON property checks, as the report will always contain an "identifiers" object. "CVE" and "CWE" will be lists even if they are empty.

Regards

@valentijnscholten
valentijnscholten merged commit 5b2990d into DefectDojo:dev Jan 16, 2021
@madchap madchap mentioned this pull request Jan 19, 2021
9alexx3 pushed a commit to 9alexx3/django-DefectDojo that referenced this pull request Aug 12, 2026
* Snyk parser: Added support for multi module reports (--all-projects)
* Snyk parser: Added missing Finding fields and minor visual changes.
* Snyk parser: [Bugfix] unique_id var can generate duplications
* Snyk parser: [Bugfix] fixed cvss ranges to meet CVSS3.x severity according to NVD
* Snyk parser: Removed HTML tags
* Snyk parser: CWE parsing refactor
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.

3 participants