fix(video-surfer): apply extract_audio path guards to save_screenshot - #8200
Open
Dev Oskii (Oskii) wants to merge 1 commit into
Open
fix(video-surfer): apply extract_audio path guards to save_screenshot#8200Dev Oskii (Oskii) wants to merge 1 commit into
Dev Oskii (Oskii) wants to merge 1 commit into
Conversation
extract_audio already rejects URL video paths and writes outside the working directory. save_screenshot did not, so an agent-chosen output path could leave the cwd. Share the same checks.
Author
|
@microsoft-github-policy-service agree |
Author
|
CLA is signed. GitHub Actions is still waiting on maintainer approval for first-time contributor workflows (Checks and the other pull_request jobs). I cannot approve those from this account. Once the workflows run I can fix any failures. A review would also unblock merge: |
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.
What
VideoSurfer's
extract_audioalready refuses a URLvideo_pathand anaudio_output_paththat resolves outside the current working directory.save_screenshottakes the same kinds of paths and did not run those checks. An agent-chosenoutput_pathsuch as../escaped.png(or an absolute path outside cwd) is passed straight tocv2.imwrite. A URLvideo_pathis passed straight tocv2.VideoCapture.On
mainat027ecf0:Default
VideoSurferincludessave_screenshotin its tool list. After this change,save_screenshotuses the same two helpers asextract_audio.Why
I was reading VideoSurfer's tools because
extract_audioalready documents an SSRF and path-traversal guard. I expectedsave_screenshotto share that jail. It does not. I confirmed the three newsave_screenshottests fail on027ecf0(they never raise the cwd/URLValueError) and pass with this patch.How
Move the URL and cwd checks into
video_surfer/_path_guards.py. Call them fromextract_audio(same behaviour, same error strings) and fromsave_screenshotbefore OpenCV runs.Testing
5 passed. The three
save_screenshotcases fail on027ecf0and pass with the patch. The twoextract_audiocases already passed on027ecf0.The test file stubs
cv2,ffmpeg, andwhisperso it runs without thevideo-surferextra.