Skip to content

Filter and validate Pollinations style refs for nova-reel (PNG-only) and improve messaging#146

Open
Mork-Zuckerbarge wants to merge 1 commit into
mainfrom
codex/fix-media-video-model-error-lvqu4h
Open

Filter and validate Pollinations style refs for nova-reel (PNG-only) and improve messaging#146
Mork-Zuckerbarge wants to merge 1 commit into
mainfrom
codex/fix-media-video-model-error-lvqu4h

Conversation

@Mork-Zuckerbarge
Copy link
Copy Markdown
Owner

Motivation

  • Prevent Pollinations nova-reel video failures by ensuring style/reference URLs are PNG images and providing actionable guidance when they are not.
  • Document the PNG requirement in the README and example env to help operators avoid common misconfiguration.

Description

  • Added detectRemoteMimeType to probe remote URLs (via HEAD then GET) and determine their content-type header.
  • Added normalizeVideoStyleReferences to filter MEDIA_STYLE_IMAGE_URLS down to image/png only when MEDIA_VIDEO_MODEL is nova-reel, and wired it into generateVideo.
  • Enhanced error text in generateVideo to surface a clear message when Pollinations rejects requests due to non-PNG style images for nova-reel.
  • Updated mork-app/README.md and mork-app/env.example to document the nova-reel PNG-only requirement and provide an example MEDIA_STYLE_IMAGE_URLS entry.

Testing

  • Ran the TypeScript build with npm run build, which completed successfully.
  • Ran the linter with npm run lint, which completed successfully.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d538cc3dfb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


async function detectRemoteMimeType(url: string): Promise<string | null> {
const attempt = async (method: "HEAD" | "GET"): Promise<string | null> => {
const res = await fetch(url, { method, cache: "no-store" });
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Block SSRF in style-reference MIME validation

The new MIME check fetches every style URL server-side, but those URLs are user-controlled via /api/app/style-pack JSON input (see mork-app/src/app/api/app/style-pack/route.ts lines 24-33) and there is no auth gate on that route. This introduces a blind SSRF path that did not exist before: an external caller can store http(s) targets on internal network ranges and trigger backend requests whenever a nova-reel video is generated. Please add URL allowlisting/private-range blocking (or avoid server-side fetch of untrusted URLs).

Useful? React with 👍 / 👎.

Comment on lines +122 to +123
for (const ref of refs) {
const mimeType = await detectRemoteMimeType(ref);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bound style MIME probe latency to avoid request hangs

Each style reference is probed sequentially with await detectRemoteMimeType(ref) and the probe uses fetch without any timeout/abort, so one slow or blackholed URL can stall generateVideo for a long time; with multiple refs this delay compounds. Because style-pack URLs are persisted and reused, a single bad URL can repeatedly degrade or effectively DoS video generation for all users until manually removed. Add per-request timeouts and/or parallel probing with a strict overall cap.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant