Skip to content

3520: Added OSSIndex Devaudit scanner import functionality - #3570

Merged
valentijnscholten merged 16 commits into
DefectDojo:devfrom
bp4151:bparr-3520
Jan 15, 2021
Merged

valentijnscholten merged 16 commits into
DefectDojo:devfrom
bp4151:bparr-3520

Conversation

@bp4151

@bp4151 bp4151 commented Dec 30, 2020 •

Copy link
Copy Markdown
Contributor

Squashed prior commits
3520: Added OSSIndex Devaudit scanner import functionality
3520: Added missing test_type.json changes
3520: OSSIndex Devaudit scanner import naming and EOF fixes

3520: Added OSSIndex Devaudit scanner import functionality
3520: OSSIndex Devaudit scanner import naming and EOF fixes


3520: Flake8 Lint fix, naming fix


3520: Unit test file format fix


3520: parser.py linting fixes


3520: Unit test file format fix


3520: Unit test file format fix


3520: Unit test file format fix


3520: Flake8 format fix
@bp4151 bp4151 closed this Jan 1, 2021
@bp4151 bp4151 reopened this Jan 1, 2021
Comment thread dojo/tools/ossindex_devaudit/parser.py Resolved
Comment thread dojo/fixtures/test_type.json Resolved
Comment thread dojo/tools/ossindex_devaudit/parser.py Resolved
Comment thread dojo/fixtures/test_type.json Resolved
Comment thread dojo/tools/factory.py Resolved
@bp4151

bp4151 commented Jan 2, 2021

Copy link
Copy Markdown
Contributor Author

All above comments have been addressed. Please let me know if you would like a squash commit like the previous attempt.

@valentijnscholten

Copy link
Copy Markdown
Member

Thanks. Can you double check if all the references fields are always present? Everywhere where there is a data['field'] construct, there is a chance for a KeyError if the field is not present. To prevent that, you could use something like data.get('field', None).

Changed handling of reference field 
1) use data.get in case the reference field is ever missing. 
2) always add the snyk reference first so reference data is present. 
3) add unit tests for empty reference, missing reference, check for starting with Snyk reference.
Comment thread dojo/tools/ossindex_devaudit/parser.py Resolved
Comment thread dojo/tools/ossindex_devaudit/parser.py Resolved
Changed handling of cwe field 
1) use data.get in case the cwe field is ever missing. 
2) check cwe data and set cwe to 1035 if empty or None 
3) If cwe data is present, replace the "CWE-" with empty string to get the numeric cwe value
4) add unit tests for empty cwe, missing cwe, null cwe.
Comment thread dojo/tools/ossindex_devaudit/parser.py Resolved
Comment thread dojo/tools/ossindex_devaudit/parser.py Resolved
Comment thread dojo/tools/ossindex_devaudit/parser.py Resolved
Comment thread dojo/tools/ossindex_devaudit/parser.py Resolved
Comment thread dojo/tools/ossindex_devaudit/parser.py Resolved
Comment thread dojo/tools/ossindex_devaudit/parser.py Resolved
Comment thread dojo/tools/ossindex_devaudit/parser.py Resolved
Comment thread dojo/tools/ossindex_devaudit/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.

Made some comment and suggestions.

@valentijnscholten

Copy link
Copy Markdown
Member

To me the link to snyk looks useful to have here, or maybe we should add/show it always in defect dojo. But the link here seems to use the dependency_source value, which is not present in the dojo model.

Just doing an int(something) is not safe, it will raise an exception if something is not parseable as int: https://stackoverflow.com/questions/8075877/converting-string-to-int-using-try-except-in-python

Changed parser and unit test
Tested using import file with cvss score missing, 0, and 11.

@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.

Look good to me

@valentijnscholten

Copy link
Copy Markdown
Member

Thanks. Could add a PR for documentation in https://github.com/DefectDojo/Documentation and a sample scan in https://github.com/DefectDojo/sample-scan-files

@madchap

madchap commented Jan 9, 2021

Copy link
Copy Markdown
Contributor

If you could please provide the minimal documentation at https://github.com/DefectDojo/Documentation/blob/master/docs/integrations.rst and PR up a sample scan file at https://github.com/DefectDojo/sample-scan-files

Once linked here, we can merge your new parser.

Thanks!

@bp4151

bp4151 commented Jan 9, 2021 via email

Copy link
Copy Markdown
Contributor Author

@bp4151

bp4151 commented Jan 12, 2021

Copy link
Copy Markdown
Contributor Author

Sample Scan PR
DefectDojo/sample-scan-files#65

Documentation PR
DefectDojo/Documentation#168

@valentijnscholten

Copy link
Copy Markdown
Member

resolved conflicts

@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.

Thre is still some formatting error

@bp4151

bp4151 commented Jan 14, 2021

Copy link
Copy Markdown
Contributor Author

Thre is still some formatting error

Hey Damien,

As I am new to this whole process, I could use your help. I had this passing last week, but it looks like something else changed that is impacting my commits. Do I need to sync my fork and go through everything again?

Regards,
Bruce

@damiencarol

Copy link
Copy Markdown
Contributor

For now for what I can see:

  1. you have formatting errors, you can see them in this step
    image
    You can have more details by clicking on "Details"

  2. you need to fix them as the CI checks the formatting of Python code with flake8 tool

  3. you can see them in your dev env if you install flake8 and run it

  4. YES I CAN HELP YOU :P

I will assist you to finish the pull request. If your ok, I can fix your formatting errors

@damiencarol

Copy link
Copy Markdown
Contributor

@bp4151 I fixed your formatting bps. Thanks for your effort and your patience.

It should be ok now 🌈

@damiencarol
damiencarol self-requested a review January 14, 2021 19:14
@valentijnscholten

Copy link
Copy Markdown
Member

Thanks @bp4151 . Sometimes it takes some iterations to make sure it's future proof :-)

@valentijnscholten
valentijnscholten merged commit 1080058 into DefectDojo:dev Jan 15, 2021
@bp4151
bp4151 deleted the bparr-3520 branch January 15, 2021 16:27
@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
 Added OSSIndex Devaudit scanner import functionality
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.

5 participants