Skip to content

cvedb: Create aiohttp ClientSession with trust_env=True #923

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

Merged
merged 1 commit into from
Oct 21, 2020
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: 1 addition & 1 deletion cve_bin_tool/cvedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ async def refresh(self):
self.LOGGER.info("Checking if there is a newer version.")
check_latest_version()
if not self.session:
self.session = aiohttp.ClientSession()
self.session = aiohttp.ClientSession(trust_env=True)
self.LOGGER.info("Downloading CVE data...")
nvd_metadata, curl_metadata = await asyncio.gather(
self.nist_scrape(self.session), self.get_curl_versions(self.session)
Expand Down
6 changes: 3 additions & 3 deletions test/test_cvedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def teardown_class(cls):

@pytest.mark.asyncio
async def test_00_getmeta(self):
async with aiohttp.ClientSession() as session:
async with aiohttp.ClientSession(trust_env=True) as session:
_jsonurl, meta = await self.cvedb.getmeta(
session,
"https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-modified.meta",
Expand All @@ -31,7 +31,7 @@ async def test_00_getmeta(self):

@pytest.mark.asyncio
async def test_01_nist_scrape(self):
async with aiohttp.ClientSession() as session:
async with aiohttp.ClientSession(trust_env=True) as session:
jsonshas = await self.cvedb.nist_scrape(session)
assert (
"https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2015.json.gz"
Expand All @@ -40,7 +40,7 @@ async def test_01_nist_scrape(self):

@pytest.mark.asyncio
async def test_02_cache_update(self):
async with aiohttp.ClientSession() as session:
async with aiohttp.ClientSession(trust_env=True) as session:
jsonurl, meta = await self.cvedb.getmeta(
session, "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2015.meta"
)
Expand Down