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

Support additional exclude vulnerability files #269

Merged
merged 6 commits into from
Jun 22, 2022
Merged

Support additional exclude vulnerability files #269

merged 6 commits into from
Jun 22, 2022

Conversation

uvegla
Copy link
Contributor

@uvegla uvegla commented Jun 14, 2022

This change adds the possibility to split .nancy-ignore files into multiple ones in a non-breaking way. The "root" file is still kept as .nancy-ignore or can be overwritten with the -x / --exclude-vulnerability-file flag but on top of that a list of additional files can be set via the -a / --additional-exclude-vulnerability-files flag.

The most common use case for using multiple files is when an organisation wants centrally control some of the common known vulnerabilities across hundreds of repositories by generating a file. It makes sense when there are common 3rd party libraries used in upstream dependencies that are either not updated anymore and the organisation cannot change the usage of them in a short period of time, but it takes a short migration for example. By generating am ignore file via automated means controlled by a central force it can save the headache for the rest of the organisation to handle these one-by-one.

However there can still be known vulnerabilities a team wants to ignore for their own repository that is specific to only that one, so the build pipeline for an organisation could look something like:

go list -json -deps | nancy sleuth -a .nancy-ignore.local

I chose to add an additional flag to keep backwards compatibility when someone uses the -x / --exclude-vulnerability-file. An other approach could be to change that flag to a list instead and rename it to -x / --exclude-vulnerability-files. Because of this it is still possible to control the root ignore file via that flag and do something like the below example.

go list -json -deps | nancy sleuth -x .nancy-ignore.generated -a .nancy-ignore.local
  • If there are changes to user behavior in general, please make sure to update the docs, as well

cc @bhamail / @DarthHater

@sonatypecla
Copy link

sonatypecla bot commented Jun 14, 2022

Thanks for the contribution! Before we can merge this, we need @uvegla to sign the Sonatype Contributor License Agreement.

@uvegla
Copy link
Contributor Author

uvegla commented Jun 17, 2022

@bhamail @DarthHater Can I please get your feedback / review on this change? Thanks in advance! 🙇🏻

Copy link
Contributor

@bhamail bhamail left a comment

Choose a reason for hiding this comment

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

+1 Nice test coverage! Thanks!!! I plan to merge this puppy pronto. Please holler if you object to either of my changes - happy to revert them if needed.

@@ -262,13 +263,22 @@ We support exclusion of vulnerability either by CVE-ID (ex: `CVE-2018-20303`) or

##### Via file

By default if a file named `.nancy-ignore` exists in the same directory that nancy is run it will use it, will no other options need to be passed.
By default, if a file named `.nancy-ignore` exists in the same directory that nancy is run it will use it - no other options need to be passed.
Copy link
Contributor

Choose a reason for hiding this comment

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

I hope you don't object to the doc change I made here. I think it is clearer, but happy to revert if you disagree.

@bhamail bhamail merged commit 81f78ef into sonatype-nexus-community:main Jun 22, 2022
@uvegla uvegla deleted the support-additional-exclude-vulnerability-files branch June 23, 2022 07:31
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.

2 participants