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

Extract NVD_NIST_TIMEOUT to settings #308

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CveXplore/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ class Configuration(object):

NVD_NIST_API_KEY = os.getenv("NVD_NIST_API_KEY", None)
NVD_NIST_NO_REJECTED = getenv_bool("NVD_NIST_NO_REJECTED", "True")
NVD_NIST_TIMEOUT = float(os.getenv("NVD_NIST_TIMEOUT", 30.0))

HTTP_PROXY_DICT = getenv_dict("HTTP_PROXY_DICT", {})
HTTP_PROXY_STRING = os.getenv("HTTP_PROXY_STRING", "")

Expand Down
5 changes: 4 additions & 1 deletion CveXplore/core/nvd_nist/nvd_nist_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,10 @@ async def fetch_all(self, loop):
loop=loop,
headers=self.api_data.api_handle.headers,
timeout=aiohttp.ClientTimeout(
total=30.0, sock_connect=30.0, sock_read=30.0, connect=30.0
total=self.config.NVD_NIST_TIMEOUT,
sock_connect=self.config.NVD_NIST_TIMEOUT,
sock_read=self.config.NVD_NIST_TIMEOUT,
connect=self.config.NVD_NIST_TIMEOUT,
),
) as session:
results = await asyncio.gather(
Expand Down
9 changes: 9 additions & 0 deletions docs/general/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ NIST NVD API

Do not import rejected CVEs from the NIST NVD API.

.. confval:: NVD_NIST_TIMEOUT

Request timeout in seconds.

This value is used by aiohttp to set time limits for asynchronous requests to the NVD API,
including connection timeout and read timeout.

E.g., ``30.0``

Downloads
*********

Expand Down
Loading