Skip to content

Commit 20dd2f6

Browse files
committed
[3.15] gh-161263: Skip MD5 algorithm challenge tests on FIPS
(cherry picked from commit 41c224c) Co-authored-by: Seth Larson <seth@python.org>
1 parent bdd3f1c commit 20dd2f6

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎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)
@@ -1751,6 +1756,7 @@ def test_proxy_basic_auth(self):
17511756
"proxy.example.com:3128",
17521757
)
17531758

1759+
@skip_libssl_fips_mode # Uses MD5 algorithm in challenge
17541760
def test_proxy_digest_auth(self):
17551761
# gh-60299: ProxyDigestAuthHandler must look up credentials using
17561762
# the proxy's authority
@@ -1814,6 +1820,7 @@ def test_proxy_digest_auth_uri(self):
18141820
auth = http_handler.requests[1].get_header("Proxy-authorization")
18151821
self.assertIn('uri="%s"' % request_url, auth)
18161822

1823+
@skip_libssl_fips_mode # Uses MD5 algorithm in challenge
18171824
def test_digest_auth_uses_full_url(self):
18181825
# The non-proxy case must keep using the full request URL (not
18191826
# just the host) for the password lookup, so that sub-URI realm
@@ -1936,6 +1943,7 @@ def check_digest_auth(self, headers, realm):
19361943
self.assertIn('nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093"', auth)
19371944
self.assertIn('opaque="5ccc069c403ebaf9f0171e9517f40e41"', auth)
19381945

1946+
@skip_libssl_fips_mode
19391947
def test_digest_auth_multiple_challenges(self):
19401948
realm = "digest@example.com"
19411949
digest = (f'Digest realm="{realm}", '
@@ -2001,6 +2009,7 @@ def test_digest_auth_parse_challenges(self):
20012009
[('Negotiate', 'Negotiate'), ('Bearer', 'Bearer abc=='),
20022010
('Digest', 'Digest realm="a"')])
20032011

2012+
@skip_libssl_fips_mode
20042013
def test_proxy_digest_auth_multiple_challenges(self):
20052014
realm = "digest@example.com"
20062015
digest = (f'Digest realm="{realm}", '
@@ -2324,12 +2333,6 @@ def test_parse_proxy(self):
23242333
self.assertRaises(ValueError, _parse_proxy, 'file:/ftp.example.com'),
23252334

23262335

2327-
skip_libssl_fips_mode = unittest.skipIf(
2328-
support.is_libssl_fips_mode(),
2329-
"conservative skip due to OpenSSL FIPS mode possible algorithm nerfing",
2330-
)
2331-
2332-
23332336
class TestDigestAuthAlgorithms(unittest.TestCase):
23342337
def setUp(self):
23352338
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)