🔒 Make sure to validate log paths for zip bundle

Also do the same for timelapses.

For individual files, the LargeResponseHandler takes care of this
validation. For zip downloads however, we need to do it. An earlier
refactoring accidentally applied the same logic to the invididual
downloads as well, though in a broken way, this now fixes behaviour in
both variants.
This commit is contained in:
Gina Häußge committed 2021-03-15 14:57:17 +01:00
1 parent 9c33571dc9
commit 770492a955
1 file changed
+8 -3
+8 -3
View File
@@ -760,8 +760,10 @@ class Server(object):
}
timelapses_path_validator = {
"path_validation": util.tornado.path_validation_factory(
lambda path: not octoprint.util.is_hidden_path(path)
and octoprint.timelapse.valid_timelapse(path),
lambda path: valid_timelapse(path)
and os.path.realpath(os.path.abspath(path)).startswith(
settings().getBaseFolder("timelapse")
),
status_code=400,
)
}
@@ -777,7 +779,10 @@ class Server(object):
}
logs_path_validator = {
"path_validation": util.tornado.path_validation_factory(
valid_log,
lambda path: valid_log(path)
and os.path.realpath(os.path.abspath(path)).startswith(
settings().getBaseFolder("logs")
),
status_code=400,
)
}