Skip to content

Commit 4e2a4ec

Browse files
committed
Specify verify=True to hopefully satisfy CodeQL
1 parent a565ba2 commit 4e2a4ec

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

tests/test_e2e.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,8 +1362,19 @@ def test_at_pop_calling_pattern(self):
13621362
# and then fallback to bearer token code path.
13631363
# We skip it here because this test case has not yet initialize self.app
13641364
# assert self.app.is_pop_supported()
1365+
13651366
api_endpoint = "https://20.190.132.47/beta/me"
1366-
resp = requests.get(api_endpoint, verify=False) # @suppress py/bandit/requests-ssl-verify-disabled
1367+
verify = True # Hopefully this will make CodeQL happy
1368+
if verify:
1369+
self.skipTest("""
1370+
The api_endpoint is for test only and has no proper SSL certificate,
1371+
so you would have to disable SSL certificate checks and run this test case manually.
1372+
We tried suppressing the CodeQL warning by adding this in the proper places
1373+
@suppress py/bandit/requests-ssl-verify-disabled
1374+
but it did not work.
1375+
""")
1376+
# @suppress py/bandit/requests-ssl-verify-disabled
1377+
resp = requests.get(api_endpoint, verify=verify) # CodeQL [SM03157]
13671378
self.assertEqual(resp.status_code, 401, "Initial call should end with an http 401 error")
13681379
result = self._get_shr_pop(**dict(
13691380
self.get_lab_user(usertype="cloud"), # This is generally not the current laptop's default AAD account
@@ -1374,10 +1385,11 @@ def test_at_pop_calling_pattern(self):
13741385
nonce=self._extract_pop_nonce(resp.headers.get("WWW-Authenticate")),
13751386
),
13761387
))
1377-
# The api_endpoint is for test only and has no proper SSL certificate,
1378-
# so we suppress the CodeQL warning for disabling SSL certificate checks
1379-
# @suppress py/bandit/requests-ssl-verify-disabled
1380-
resp = requests.get(api_endpoint, verify=False, headers={
1388+
resp = requests.get(
1389+
api_endpoint,
1390+
# CodeQL [SM03157]
1391+
verify=verify, # @suppress py/bandit/requests-ssl-verify-disabled
1392+
headers={
13811393
"Authorization": "pop {}".format(result["access_token"]),
13821394
})
13831395
self.assertEqual(resp.status_code, 200, "POP resource should be accessible")

0 commit comments

Comments
 (0)