Skip to content

Commit d29d81e

Browse files
committed
Prevent accessing files outside target dir
1 parent d40460e commit d29d81e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

motioneye/mediafiles.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ def get_media_path(camera_config, path, media_type):
466466
def get_media_content(camera_config, path, media_type):
467467
target_dir = camera_config.get('target_dir')
468468

469+
if '..' in path:
470+
raise Exception('invalid media path')
471+
469472
full_path = os.path.join(target_dir, path)
470473

471474
try:

0 commit comments

Comments
 (0)