@@ -15,95 +15,3 @@ def test_rejects_ftp(self):
1515
1616 def test_accepts_https (self ):
1717 validate_url_for_source ("https://example.com/file.pdf" )
18-
19-
20- class TestValidateUrlUserinfo :
21- def test_rejects_username_and_password (self ):
22- with pytest .raises (MindeeSourceError , match = "credentials" ):
23- validate_url_for_source ("https://user:pass@example.com/file.pdf" )
24-
25- def test_rejects_username_only (self ):
26- with pytest .raises (MindeeSourceError , match = "credentials" ):
27- validate_url_for_source ("https://user@example.com/file.pdf" )
28-
29-
30- class TestValidateUrlLoopbackHostnames :
31- def test_rejects_localhost (self ):
32- with pytest .raises (MindeeSourceError , match = "Loopback" ):
33- validate_url_for_source ("https://localhost/file.pdf" )
34-
35- def test_rejects_localhost_subdomain (self ):
36- with pytest .raises (MindeeSourceError , match = "Loopback" ):
37- validate_url_for_source ("https://myapp.localhost/file.pdf" )
38-
39- def test_rejects_ip6_localhost (self ):
40- with pytest .raises (MindeeSourceError , match = "Loopback" ):
41- validate_url_for_source ("https://ip6-localhost/file.pdf" )
42-
43- def test_rejects_ip6_loopback (self ):
44- with pytest .raises (MindeeSourceError , match = "Loopback" ):
45- validate_url_for_source ("https://ip6-loopback/file.pdf" )
46-
47-
48- class TestValidateUrlLoopbackIPs :
49- def test_rejects_ipv4_loopback (self ):
50- with pytest .raises (MindeeSourceError , match = "disallowed" ):
51- validate_url_for_source ("https://127.0.0.1/file.pdf" )
52-
53- def test_rejects_ipv4_loopback_other (self ):
54- with pytest .raises (MindeeSourceError , match = "disallowed" ):
55- validate_url_for_source ("https://127.0.0.2/file.pdf" )
56-
57- def test_rejects_ipv6_loopback (self ):
58- with pytest .raises (MindeeSourceError , match = "disallowed" ):
59- validate_url_for_source ("https://[::1]/file.pdf" )
60-
61-
62- class TestValidateUrlPrivateIPs :
63- def test_rejects_rfc1918_10_block (self ):
64- with pytest .raises (MindeeSourceError , match = "disallowed" ):
65- validate_url_for_source ("https://10.0.0.1/file.pdf" )
66-
67- def test_rejects_rfc1918_172_block (self ):
68- with pytest .raises (MindeeSourceError , match = "disallowed" ):
69- validate_url_for_source ("https://172.16.0.1/file.pdf" )
70-
71- def test_rejects_rfc1918_192_block (self ):
72- with pytest .raises (MindeeSourceError , match = "disallowed" ):
73- validate_url_for_source ("https://192.168.1.1/file.pdf" )
74-
75- def test_rejects_link_local (self ):
76- with pytest .raises (MindeeSourceError , match = "disallowed" ):
77- validate_url_for_source ("https://169.254.0.1/file.pdf" )
78-
79- def test_rejects_unspecified (self ):
80- with pytest .raises (MindeeSourceError , match = "disallowed" ):
81- validate_url_for_source ("https://0.0.0.0/file.pdf" )
82-
83- def test_rejects_multicast (self ):
84- with pytest .raises (MindeeSourceError , match = "disallowed" ):
85- validate_url_for_source ("https://224.0.0.1/file.pdf" )
86-
87-
88- class TestValidateUrlCgnat :
89- def test_rejects_cgnat_start (self ):
90- with pytest .raises (MindeeSourceError , match = "disallowed" ):
91- validate_url_for_source ("https://100.64.0.1/file.pdf" )
92-
93- def test_rejects_cgnat_end (self ):
94- with pytest .raises (MindeeSourceError , match = "disallowed" ):
95- validate_url_for_source ("https://100.127.255.255/file.pdf" )
96-
97- def test_accepts_just_outside_cgnat (self ):
98- # 100.128.0.1 is outside 100.64.0.0/10
99- validate_url_for_source ("https://100.128.0.1/file.pdf" )
100-
101-
102- class TestValidateUrlIpv6UniqueLocal :
103- def test_rejects_ipv6_ula_fc (self ):
104- with pytest .raises (MindeeSourceError , match = "disallowed" ):
105- validate_url_for_source ("https://[fc00::1]/file.pdf" )
106-
107- def test_rejects_ipv6_ula_fd (self ):
108- with pytest .raises (MindeeSourceError , match = "disallowed" ):
109- validate_url_for_source ("https://[fd00::1]/file.pdf" )
0 commit comments