Skip to content

Commit 03d6f59

Browse files
committed
Added a test when auth_string containing white space:
When the auth_string of Authorization header contains white space, OAuth2Validator._extract_basic_auth raises IndexError. It could be vulnerability.
1 parent 060022f commit 03d6f59

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

oauth2_provider/tests/test_oauth2_validators.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def test_extract_basic_auth(self):
4242
self.assertIsNone(self.validator._extract_basic_auth(self.request))
4343
self.request.headers = {'HTTP_AUTHORIZATION': 'Dummy 123456'}
4444
self.assertIsNone(self.validator._extract_basic_auth(self.request))
45+
self.request.headers = {'HTTP_AUTHORIZATION': 'Basic 123456 789'}
46+
self.assertEqual(self.validator._extract_basic_auth(self.request), '123456 789')
4547

4648
def test_authenticate_client_id(self):
4749
self.assertTrue(self.validator.authenticate_client_id('client_id', self.request))

0 commit comments

Comments
 (0)