-
Notifications
You must be signed in to change notification settings - Fork 506
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
feat: add NVD API key #1529
feat: add NVD API key #1529
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1529 +/- ##
==========================================
+ Coverage 79.27% 83.01% +3.74%
==========================================
Files 281 281
Lines 5548 5553 +5
Branches 905 906 +1
==========================================
+ Hits 4398 4610 +212
+ Misses 966 754 -212
- Partials 184 189 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Note to self: since I don't want to put a real API key directly into the tests, we'll probably just want to test what happens when a bad one is specified. As you might expect, this causes the NVD API to return an error. (I am going to have to plumb a real API key through github actions' secrets and make it work in pytest eventually, but that might not happen in this PR.) |
Okay, this should be working and ready for review. I realized it doesn't really need separate tests yet because it's changing the main code path and I don't have any good way to put a real API key in there at the moment. I am going to add code to handle bad API keys and tests for that, but I think that's going to happen in a separate PR. |
Pinging @BreadGenie, @anthonyharrison and @imsahil007 for review if you have time. (since github won't let me request reviews from any of you directly) |
I think it would be great if we can add a message as a suggestion with the requesting NVD API key link in case the user is not setting this value. But that can be added later in a separate issue. |
Looks like I should probably set up the NVD key in github actions so that the long tests pass here. I need to do some backend wrangling to set it up as a github secret, but I'll go start the request process for that now. |
Yeah, that's a good plan. It would be ideal if we put it any time someone gets a 403 from NVD (because that's usually the indication that they're rate limited and really need it) but let me at least add a reminder to go under the boilerplate text from NVD in this PR and we can figure out some improved reminders in a future one. |
Fixed the key case issue (thanks @BreadGenie ) and added a "how to get a key" link (thanks @imsahil007 ) I expect to be getting my NVD API key set up in github actions .. probably tomorrow? (I have to go through our ops team to set secret variables on the main repo.) So hopefully I'll be able to resolve our failing long test when that's integrated. |
I've added support for an $nvd_api_key environment variable, then set that up to work as expected in GitHub actions. (Thanks awesome and fast ops folk!) This should fix the issue we've been having with rate limiting in GitHub Actions where the long tests have been failing. At least, it fixed it for this PR, but as the issue has been a bit sporadic it's still possible that once is a coincidence. |
I was hoping to get a code review form @antoniogi but he's been a bit too busy and it's been over a week. Since this should fix most of our CI issues at the moment I don't want to wait any longer, so I'm going to go ahead and merge. Reviews always welcome later if anyone has anything else to say about the API code. |
This PR will add support for NVD API keys
nvd_api.py
#1428This includes the following:
--nvd-api-key
to the command line