File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ def test_safe_web_path_blocks_relative_traversal():
1818 assert safe_web_path ("../../../../Windows/win.ini" ) is None
1919
2020
21+ @pytest .mark .skipif (os .name != "nt" ,
22+ reason = "drive-absolute os.path.join discard is an "
23+ "ntpath-only quirk; on POSIX there's no drive "
24+ "letter so the path safely stays under WEB_DIR" )
2125def test_safe_web_path_blocks_windows_drive_absolute_traversal ():
2226 # The bug this locks in: os.path.join(WEB_DIR, "C:/x") on Windows
2327 # discards WEB_DIR entirely because the second arg is drive-absolute.
@@ -68,6 +72,10 @@ def test_live_server_serves_data_json(live_server):
6872 assert resp .status == 200
6973
7074
75+ @pytest .mark .skipif (os .name != "nt" ,
76+ reason = "drive-absolute os.path.join discard is an "
77+ "ntpath-only quirk; on POSIX the request just "
78+ "404s as a normal missing file under WEB_DIR" )
7179def test_live_server_rejects_drive_absolute_traversal (live_server ):
7280 drive = os .path .splitdrive (WEB_DIR )[0 ] or "C:"
7381 with pytest .raises (urllib .error .HTTPError ) as exc :
You can’t perform that action at this time.
0 commit comments