diff options
| author | Ethan Furman <ethan@stoneleaf.us> | 2023-05-03 03:42:00 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-03 03:42:00 (GMT) |
| commit | c7c3a60c88de61a79ded9fdaf6bc6a29da4efb9a (patch) | |
| tree | d36dfffa5974a55a36fcda2e178a25a2081704d3 /Lib/test/test_httpservers.py | |
| parent | 292076a9aa29aba1023340a0d24252a7b27a454e (diff) | |
| download | cpython-c7c3a60c88de61a79ded9fdaf6bc6a29da4efb9a.zip cpython-c7c3a60c88de61a79ded9fdaf6bc6a29da4efb9a.tar.gz cpython-c7c3a60c88de61a79ded9fdaf6bc6a29da4efb9a.tar.bz2 | |
gh-104049: do not expose on-disk location from SimpleHTTPRequestHandler (#104067)
Do not expose the local server's on-disk location from `SimpleHTTPRequestHandler` when generating a directory index. (unnecessary information disclosure)
---------
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib/test/test_httpservers.py')
| -rw-r--r-- | Lib/test/test_httpservers.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index cbcf941..0382b5e 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -418,6 +418,14 @@ class SimpleHTTPServerTestCase(BaseTestCase): self.check_status_and_reason(response, HTTPStatus.OK, data=os_helper.TESTFN_UNDECODABLE) + 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')) + # 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')) + def test_get_dir_redirect_location_domain_injection_bug(self): """Ensure //evil.co/..%2f../../X does not put //evil.co/ in Location. |
