Skip to content

Potential fix for code scanning alert no. 2: Uncontrolled command line - #71

Merged
cwlacewe merged 1 commit into
mainfrom
alert-autofix-2
Sep 10, 2026
Merged

cwlacewe merged 1 commit into
mainfrom
alert-autofix-2

Conversation

@cwlacewe

Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/IntelLabs/Video-Curation-Sample/security/code-scanning/2

To fix this without changing intended functionality, enforce strict filename validation in video/utils.py and ensure ffprobe treats the input as a positional argument, not an option, in video/info.py.

Best concrete fix:

  1. Repair and harden validate_video_name in video/utils.py:
    • Ensure path separators are rejected with an actual raise.
    • Reject names starting with . (already intended).
    • Reject names starting with - to prevent option injection.
    • Keep allowlist regex.
    • Remove duplicated unreachable raise.
  2. Add -- before the input path in ffprobe command construction in video/info.py so option parsing is explicitly terminated before the user-influenced path.

Files/regions to change:

  • video/utils.py: validate_video_name function block.
  • video/info.py: cmd list in _get_info.

No new imports or dependencies are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Refer to [Security issue](https://github.com/IntelLabs/Video-Curation-Sample/security/code-scanning/2).

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@cwlacewe
cwlacewe marked this pull request as ready for review September 10, 2026 17:40
@cwlacewe
cwlacewe merged commit b38d4b4 into main Sep 10, 2026
4 checks passed
@cwlacewe
cwlacewe deleted the alert-autofix-2 branch September 10, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants