We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 927fa4d commit ba906c1Copy full SHA for ba906c1
pymodbus/server/simulator/http_server.py
@@ -259,7 +259,9 @@ async def handle_html_static(self, request):
259
"""Handle static html."""
260
if not (page := request.path[1:]):
261
page = "index.html"
262
- file = os.path.join(self.web_path, page)
+ file = os.path.normpath(os.path.join(self.web_path, page))
263
+ if not file.startswith(self.web_path):
264
+ raise ValueError(f"File access outside {self.web_path} not permitted.")
265
try:
266
with open(file, encoding="utf-8"):
267
return web.FileResponse(file)
0 commit comments