Serveur : contrôle du chemin réel pour vendor/leaflet (traversée encodée)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Cette révision appartient à :
1 Parent
d7ce293971
révision
702b2d0470
1 fichier modifié
+4
-1
+4
-1
@@ -23,7 +23,10 @@ class H(http.server.SimpleHTTPRequestHandler):
|
||||
def _autorise(self, chemin):
|
||||
c = chemin.split('?')[0].split('#')[0]
|
||||
if c in ('/', '/index.html', '/style.css', '/app.js', '/favicon.ico'): return True
|
||||
if c.startswith('/vendor/leaflet/') and '..' not in c: return True
|
||||
if c.startswith('/vendor/leaflet/'):
|
||||
if '%' in c or chr(92) in c or '..' in c: return False
|
||||
reel = os.path.realpath(self.translate_path(c))
|
||||
return reel.startswith(os.path.realpath(os.path.join(SITE, 'vendor', 'leaflet')) + os.sep)
|
||||
return c in ('/data/stations-romma.js', '/data/stations-romma.csv', '/data/stations-romma.json', '/data/refs.js')
|
||||
def list_directory(self, path):
|
||||
self.send_error(404); return None
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur