File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -188,13 +188,28 @@ def test_alternate(self):
188
188
<xhtml:link rel="alternate" hreflang="en"/><!-- wrong tag without href -->
189
189
</url>
190
190
</urlset>""" )
191
-
191
+
192
192
self .assertEqual (list (s ), [
193
193
{'loc' : 'http://www.example.com/english/' ,
194
194
'alternate' : ['http://www.example.com/deutsch/' , 'http://www.example.com/schweiz-deutsch/' , 'http://www.example.com/english/' ]
195
195
}
196
196
])
197
197
198
+ def test_xml_entity_expansion (self ):
199
+ s = Sitemap ("""<?xml version="1.0" encoding="utf-8"?>
200
+ <!DOCTYPE foo [
201
+ <!ELEMENT foo ANY >
202
+ <!ENTITY xxe SYSTEM "file:///etc/passwd" >
203
+ ]>
204
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
205
+ <url>
206
+ <loc>http://127.0.0.1:8000/&xxe;</loc>
207
+ </url>
208
+ </urlset>
209
+ """ )
210
+
211
+ self .assertEqual (list (s ), [{'loc' : 'http://127.0.0.1:8000/' }])
212
+
198
213
199
214
if __name__ == '__main__' :
200
215
unittest .main ()
You can’t perform that action at this time.
0 commit comments