-
Notifications
You must be signed in to change notification settings - Fork 456
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 User-Agent for mirroring #3183
Conversation
This adds a User-Agent header to cve-bin-tool, currently used only when getting data from a mirror (as opposed to downloading directly from other data_sources). Signed-off-by: Terri Oda <terri.oda@intel.com>
There are still some requests-based url loads that are not covered. Signed-off-by: Terri Oda <terri@toybox.ca>
Codecov Report
@@ Coverage Diff @@
## main #3183 +/- ##
==========================================
- Coverage 81.40% 79.27% -2.13%
==========================================
Files 716 714 -2
Lines 11114 10983 -131
Branches 1495 1271 -224
==========================================
- Hits 9047 8707 -340
- Misses 1681 1882 +201
- Partials 386 394 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 19 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Signed-off-by: Terri Oda <terri@toybox.ca>
Signed-off-by: Terri Oda <terri@toybox.ca>
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.
Looks good to me, possibly worth extending this functionality in the future!
@@ -10,6 +10,10 @@ | |||
|
|||
VERSION: str = "3.2.2dev0" | |||
|
|||
HTTP_HEADERS: dict = { |
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.
My only comment here is that this is such a good idea it may be worth adding an environment variable, command line arg, or configuration option to let the user optionally specify this value. The list of sources doesn't have anything I would anticipate adding user-agent checks, but it's possible corporate firewalls or some such thing may restrict outbound user agents.
Thanks all, let's get this merged! |
This adds a User-Agent header to cve-bin-tool, currently used only for aiohttp requests used in data_sources and mirroring. Here's what it looks like trying an experiment on localhost right now:
At this time, the PR doesn't cover any url loads using
requests
, only the ones usingaiohttp