Fix invalid string escape

This commit is contained in:
Łukasz Langa 2023-08-24 19:44:27 +02:00
parent d2cd0a3acb
commit 92f9ce726b
No known key found for this signature in database
GPG key ID: B26995E310250568

View file

@ -418,10 +418,10 @@ def test_undecodable_filename(self):
def test_undecodable_parameter(self):
# sanity check using a valid parameter
response = self.request(self.base_url + '/?x=123').read()
self.assertRegex(response, f'listing for {self.base_url}/\?x=123'.encode('latin1'))
self.assertRegex(response, f'listing for {self.base_url}/\\?x=123'.encode('latin1'))
# now the bogus encoding
response = self.request(self.base_url + '/?x=%bb').read()
self.assertRegex(response, f'listing for {self.base_url}/\?x=\xef\xbf\xbd'.encode('latin1'))
self.assertRegex(response, f'listing for {self.base_url}/\\?x=\xef\xbf\xbd'.encode('latin1'))
def test_get_dir_redirect_location_domain_injection_bug(self):
"""Ensure //evil.co/..%2f../../X does not put //evil.co/ in Location.