Skip to content

FIX: Validate API local media paths against results storage - #3061

Open
Richard Lundeen (richlundeen) wants to merge 2 commits into
microsoft:mainfrom
richlundeen:richlundeen-local-media-path-validation
Open

Richard Lundeen (richlundeen) wants to merge 2 commits into
microsoft:mainfrom
richlundeen:richlundeen-local-media-path-validation

Conversation

@richlundeen

@richlundeen Richard Lundeen (richlundeen) commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

API media preparation could accept a local file, or extract one from /api/media?path=..., that GET /api/media would reject. This let preview or message preparation read files outside the allowed media directories.

Move the existing canonical-path containment check into the shared backend media persistence service. Client-supplied local media must resolve into prompt-memory-entries or seed-prompt-entries under the configured results directory. Apply the check to preview, original and converted message values, and prepended history before conversion or target I/O. Reject media references without a path, and prevent similar /api/media-prefixed file names from bypassing the local-path check.

Keep the existing GET /api/media status codes and rendering/download behavior. Preserve HTTP(S) URLs, base64/data URI uploads, managed references, and converter-generated outputs. This is an API input check, not a new SDK path or URL policy. No dependency or uv.lock changes.

Reuse the media route's canonical containment check for preview and message inputs. Validate original and converted media, reject incomplete media references, and keep URLs, uploads, and converter outputs unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 59fd033b-89ce-4424-b418-510b8144b8c8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 59fd033b-89ce-4424-b418-510b8144b8c8

This branch has not been deployed

No deployments
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