T09 · Insecure Skill Coding Practices
- Location
scripts/subtitle_processor.py:139- Finding
FFmpeg Filter-Graph Injection Through Insufficiently Escaped Paths and Style Values
- Content
View full analysis
str: """Convert a style dictionary into an ASS format string.""" return ( f"FontName={style['font']}," f"FontSize={style['fontsize']}," f"PrimaryColour={style['primary_color']}," f"OutlineColour={style['outline_color']}," f"BackColour={style['back_color']}," f"Bold={style['bold']}," f"Italic={style['italic']}," f"Underline={style['underline']}," f"StrikeOut={style['strikeout']}," f"BorderStyle={style['border_style']}," f"Outline={style['outline']}," f"Shadow={style['shadow']}," f"Alignment={style['alignment']}," f"MarginL={style['margin_l']}," f"MarginR={style['margin_r']}," f"MarginV={style['margin_v']}," f"Alpha={style['alpha']}" ) ``` `scripts/subtitle_processor.py:195-214`: ```python # FFmpeg on Windows requires forward slashes subtitle_ffmpeg = subtitle_rel.replace("\\", "/") video_ffmpeg = video_rel.replace("\\", "/") output_ffmpeg = output_rel.replace("\\", "/") # Generate style string; special characters in ASS format require escaping style_str = style_to_ass_string(style) style_str_escaped = style_str.replace("\\", "\\\\").replace(":", "\\:").replace(",", "\\,").replace("'", "\\'") # FFmpeg command using the subtitles filter vf_filter = f"subtitles='{subtitle_ffmpeg}':force_style='{style_str_escaped}'" cmd = [ "ffmpeg", "-i", video_ffmpeg, "-vf", vf_filter, "-c:a", "copy", "-y", output_ffmpeg ] ``` `scripts/video_processor.py:352-363`: ```python subtitle_abs = str(Path(subtitle_path).resolve()).replace("\\", "/") video_abs = str(Path(video_p ...[truncated 2754 chars]- Remediation
View remediation
