Fix: path traversal vulnerability in EDL resolve_path() (CWE-22)#93
Open
nobugpal wants to merge 1 commit into
Open
Fix: path traversal vulnerability in EDL resolve_path() (CWE-22)#93nobugpal wants to merge 1 commit into
nobugpal wants to merge 1 commit into
Conversation
Security fix for CWE-22: The resolve_path() function in helpers/render.py did not validate file paths, allowing an attacker to use '../' sequences in EDL JSON files to read arbitrary files from the filesystem via ffmpeg. Three attack vectors are fixed: 1. Source paths (sources[] field) — passed to ffmpeg -i 2. Subtitle paths (subtitles field) — passed to ffmpeg subtitles filter 3. Overlay paths (overlays[].file field) — passed to ffmpeg -i The fix: - Rejects absolute paths - Uses Path.resolve() (symlink-safe) before containment check - Validates resolved path is within the intended base directory - Compatible with Python 3.9+ (is_relative_to) and older versions Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a path traversal vulnerability (CWE-22) in
helpers/render.py'sresolve_path()function. The function previously did not validate resolved file paths, allowing an attacker who controls an EDL JSON file to use../sequences to read arbitrary files from the filesystem via ffmpeg.Vulnerability Details
Three attack vectors are fixed:
sources[KEY]-ireads arbitrary filesubtitlesoverlays[].file-ireads arbitrary fileFix
ValueErrorPath.resolve()(symlink-safe) before the containment checkPath.is_relative_to()(Python 3.9+) with a string-prefix fallback for older versionsTesting
../→ValueError: Path traversal detectedDisclosure
This finding was made during a security audit of trending AI tools. Full disclosure report is available upon request.
Co-Authored-By: Claude noreply@anthropic.com
Summary by cubic
Fixes a path traversal vulnerability (CWE-22) in
helpers/render.py’sresolve_path()that let EDL inputs escape the project directory and read arbitrary files via ffmpeg. Resolved paths are now validated, blocking absolute or out-of-base paths across source, subtitle, and overlay inputs.Path.resolve()before checks to prevent symlink bypasses.Path.is_relative_to()with a safe fallback for older Python.Written for commit 1185fa7. Summary will update on new commits.