-
-
Notifications
You must be signed in to change notification settings - Fork 16
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 new feature --ignore #38
Add new feature --ignore #38
Conversation
* --ignore is used to ignore all CVE ids found a provided file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thank you for the pull request. Sorry for the delay with a review. The pull request looks good to me. Small nitpicks down below
@@ -70,6 +71,8 @@ def main(args=sys.argv[1:]): | |||
help="don't use files hint from cocci rules") | |||
parser.add_argument('--metadata', metavar='PATH', | |||
help="Path to non-standard location of kernel_cves.json.gz") | |||
parser.add_argument('--ignore', nargs='?', const='-', | |||
help="Ignore CVEs from file (seperated by new line)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/seperated/separated/
@@ -170,6 +173,17 @@ def main(args=sys.argv[1:]): | |||
print('Unknown CVE:', cve, file=sys.stderr) | |||
sys.exit(1) | |||
|
|||
if args['ignore']: | |||
with open(args['ignore'], 'r', encoding='utf-8') as ignore_file: | |||
cve_id = re.compile(r'^CVE-\d{4}-\d{4,7}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can use already compiled cve_id pattern. This line seems excessive.
@@ -28,6 +28,7 @@ def check_config(config): | |||
'report', | |||
'all_files', | |||
'metadata', | |||
'ignore', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use already existing --exclude
for this. Just check is it a CVE-id or file with CVE-ids.
Thanks! I merged the branch. I'll add some small changes in follow up commits. |
This feature would be really usefull for automations or scripts using cvehound due to the fact that passing a file is easier than concatenate a string