-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bpo-43223: Fix Open Redirection In http.server module
Fix an open redirection vulnerability in the HTTP server when a URL contains ``//``. Added test case for bpo-43223 patch
- Loading branch information
1 parent
5eb7796
commit 42eb552
Showing
3 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import unittest | ||
import re | ||
|
||
class TestHTTP(unittest.TestCase): | ||
|
||
def test_http_parse_request(self): | ||
self.assertEqual(re.sub(r'^/+', '/', '//test.com'), '/test.com', '//test.com should be converted to a proper relative path') | ||
self.assertEqual(re.sub(r'^/+', '/', '///test.com'), '/test.com', '///test.com should be converted to a proper relative path') | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Security/2021-03-13-21-25-29.bpo-43223.ieBVWq.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
:mod:`http.server`: Fix an open redirection vulnerability in the HTTP server when an URL contains ``//``. | ||
Vulnerability discovered and fixed by Hamza Avvan. |