Skip to content

Commit 458f315

Browse files
author
John Andersen
authored
cvedb: Create aiohttp ClientSession with trust_env=True (#923)
We previously left this out. Without trust_env=True aiohttp won't pick up proxy environment variables. Fixes: #922 Signed-off-by: John Andersen <[email protected]>
1 parent c2e9c68 commit 458f315

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cve_bin_tool/cvedb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ async def refresh(self):
190190
self.LOGGER.info("Checking if there is a newer version.")
191191
check_latest_version()
192192
if not self.session:
193-
self.session = aiohttp.ClientSession()
193+
self.session = aiohttp.ClientSession(trust_env=True)
194194
self.LOGGER.info("Downloading CVE data...")
195195
nvd_metadata, curl_metadata = await asyncio.gather(
196196
self.nist_scrape(self.session), self.get_curl_versions(self.session)

test/test_cvedb.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def teardown_class(cls):
2222

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

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

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

0 commit comments

Comments
 (0)