Skip to content

Validate video image URLs before download#9819

Merged
mudler merged 1 commit into
mudler:masterfrom
massy-o:codex/validate-video-url-inputs
May 14, 2026
Merged

Validate video image URLs before download#9819
mudler merged 1 commit into
mudler:masterfrom
massy-o:codex/validate-video-url-inputs

Conversation

@massy-o
Copy link
Copy Markdown
Contributor

@massy-o massy-o commented May 14, 2026

Summary

  • validate remote video start/end image URLs before downloading them
  • use a bounded HTTP client for video image downloads

Why

The image generation path already validates external URLs before fetching them. The video endpoint accepted http(s) start/end image URLs but downloaded them directly, which left the endpoint with a less strict URL-fetching policy. Reusing ValidateExternalURL blocks private, loopback, link-local, and metadata host targets before fetching.

Testing

  • gofmt -w core/http/endpoints/localai/video.go
  • git diff --check

Note: go test ./core/http/endpoints/localai currently fails in this checkout because github.com/mudler/LocalAI/pkg/grpc/proto is not present/generated.

Signed-off-by: massy-o <telitos000@gmail.com>
var videoDownloadClient = http.Client{Timeout: 30 * time.Second}

func downloadFile(url string) (string, error) {
if err := utils.ValidateExternalURL(url); err != nil {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review: This mirrors the existing image endpoint URL policy for video inputs, so private/link-local/metadata hosts are rejected before the server issues an outbound request.

@mudler mudler merged commit 745473c into mudler:master May 14, 2026
55 checks passed
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