Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pod/video_encode_transcript/Encoding_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,20 @@ def __init__(
) -> None:
"""Initialize a new Encoding_video object."""
self.id = id
self.video_file = video_file
# Secure handling of user-provided paths
base_path = getattr(settings, "MEDIA_ROOT", None)
if base_path:
norm_path = os.path.normpath(os.path.abspath(video_file))
base_path_abs = os.path.abspath(base_path)
if not norm_path.startswith(base_path_abs + os.sep):
raise ValueError(
f"Refusing video_file path outside MEDIA_ROOT. Got: {video_file}"
)
self.video_file = norm_path
else:
# Fall back to the previous assignments (should not happen in production)
self.video_file = video_file

self.duration = 0
self.list_video_track = {}
self.list_audio_track = {}
Expand Down
Loading