Skip to content

Commit 41c224c

Browse files
authored
gh-161263: Skip MD5 algorithm challenge tests on FIPS
1 parent 1dd8e71 commit 41c224c

4 files changed

Lines changed: 11 additions & 6 deletions

File tree

15 KB
Binary file not shown.
1.2 KB
Binary file not shown.

‎Lib/test/test_urllib2.py‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030

3131
support.requires_working_socket(module=True)
3232

33+
skip_libssl_fips_mode = unittest.skipIf(
34+
support.is_libssl_fips_mode(),
35+
"conservative skip due to OpenSSL FIPS mode possible algorithm nerfing",
36+
)
37+
3338
# XXX
3439
# Request
3540
# CacheFTPHandler (hard to write)
@@ -1782,6 +1787,7 @@ def test_proxy_basic_auth(self):
17821787
"proxy.example.com:3128",
17831788
)
17841789

1790+
@skip_libssl_fips_mode # Uses MD5 algorithm in challenge
17851791
def test_proxy_digest_auth(self):
17861792
# gh-60299: ProxyDigestAuthHandler must look up credentials using
17871793
# the proxy's authority
@@ -1845,6 +1851,7 @@ def test_proxy_digest_auth_uri(self):
18451851
auth = http_handler.requests[1].get_header("Proxy-authorization")
18461852
self.assertIn('uri="%s"' % request_url, auth)
18471853

1854+
@skip_libssl_fips_mode # Uses MD5 algorithm in challenge
18481855
def test_digest_auth_uses_full_url(self):
18491856
# The non-proxy case must keep using the full request URL (not
18501857
# just the host) for the password lookup, so that sub-URI realm
@@ -1967,6 +1974,7 @@ def check_digest_auth(self, headers, realm):
19671974
self.assertIn('nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093"', auth)
19681975
self.assertIn('opaque="5ccc069c403ebaf9f0171e9517f40e41"', auth)
19691976

1977+
@skip_libssl_fips_mode
19701978
def test_digest_auth_multiple_challenges(self):
19711979
realm = "digest@example.com"
19721980
digest = (f'Digest realm="{realm}", '
@@ -2032,6 +2040,7 @@ def test_digest_auth_parse_challenges(self):
20322040
[('Negotiate', 'Negotiate'), ('Bearer', 'Bearer abc=='),
20332041
('Digest', 'Digest realm="a"')])
20342042

2043+
@skip_libssl_fips_mode
20352044
def test_proxy_digest_auth_multiple_challenges(self):
20362045
realm = "digest@example.com"
20372046
digest = (f'Digest realm="{realm}", '
@@ -2355,12 +2364,6 @@ def test_parse_proxy(self):
23552364
self.assertRaises(ValueError, _parse_proxy, 'file:/ftp.example.com'),
23562365

23572366

2358-
skip_libssl_fips_mode = unittest.skipIf(
2359-
support.is_libssl_fips_mode(),
2360-
"conservative skip due to OpenSSL FIPS mode possible algorithm nerfing",
2361-
)
2362-
2363-
23642367
class TestDigestAuthAlgorithms(unittest.TestCase):
23652368
def setUp(self):
23662369
self.handler = AbstractDigestAuthHandler()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Skip tests which use MD5 algorithm for WWW-Authenticate challenges when
2+
libssl is in FIPS mode.

0 commit comments

Comments
 (0)