diff --git a/server.py b/server.py index 1f99950..1498736 100644 --- a/server.py +++ b/server.py @@ -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