Skip to content

Commit a867659

Browse files
sethmlarsonmiss-islington
authored andcommitted
gh-161263: Skip MD5 algorithm challenge tests on FIPS
(cherry picked from commit 41c224c) Co-authored-by: Seth Larson <seth@python.org>
1 parent f3f0b0a commit a867659

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)
@@ -1734,6 +1739,7 @@ def test_proxy_basic_auth(self):
17341739
"proxy.example.com:3128",
17351740
)
17361741

1742+
@skip_libssl_fips_mode # Uses MD5 algorithm in challenge
17371743
def test_proxy_digest_auth(self):
17381744
# gh-60299: ProxyDigestAuthHandler must look up credentials using
17391745
# the proxy's authority
@@ -1797,6 +1803,7 @@ def test_proxy_digest_auth_uri(self):
17971803
auth = http_handler.requests[1].get_header("Proxy-authorization")
17981804
self.assertIn('uri="%s"' % request_url, auth)
17991805

1806+
@skip_libssl_fips_mode # Uses MD5 algorithm in challenge
18001807
def test_digest_auth_uses_full_url(self):
18011808
# The non-proxy case must keep using the full request URL (not
18021809
# just the host) for the password lookup, so that sub-URI realm
@@ -1919,6 +1926,7 @@ def check_digest_auth(self, headers, realm):
19191926
self.assertIn('nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093"', auth)
19201927
self.assertIn('opaque="5ccc069c403ebaf9f0171e9517f40e41"', auth)
19211928

1929+
@skip_libssl_fips_mode
19221930
def test_digest_auth_multiple_challenges(self):
19231931
realm = "digest@example.com"
19241932
digest = (f'Digest realm="{realm}", '
@@ -1984,6 +1992,7 @@ def test_digest_auth_parse_challenges(self):
19841992
[('Negotiate', 'Negotiate'), ('Bearer', 'Bearer abc=='),
19851993
('Digest', 'Digest realm="a"')])
19861994

1995+
@skip_libssl_fips_mode
19871996
def test_proxy_digest_auth_multiple_challenges(self):
19881997
realm = "digest@example.com"
19891998
digest = (f'Digest realm="{realm}", '
@@ -2307,12 +2316,6 @@ def test_parse_proxy(self):
23072316
self.assertRaises(ValueError, _parse_proxy, 'file:/ftp.example.com'),
23082317

23092318

2310-
skip_libssl_fips_mode = unittest.skipIf(
2311-
support.is_libssl_fips_mode(),
2312-
"conservative skip due to OpenSSL FIPS mode possible algorithm nerfing",
2313-
)
2314-
2315-
23162319
class TestDigestAuthAlgorithms(unittest.TestCase):
23172320
def setUp(self):
23182321
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)