Skip to content

fix(prompt): skip generating download requests for data URLs#14131

Open
Diode11-Alt wants to merge 1 commit intovercel:mainfrom
Diode11-Alt:fix/ssrf-data-urls
Open

fix(prompt): skip generating download requests for data URLs#14131
Diode11-Alt wants to merge 1 commit intovercel:mainfrom
Diode11-Alt:fix/ssrf-data-urls

Conversation

@Diode11-Alt
Copy link
Copy Markdown

Fixes #13103

Description

This fixes a critical regression where valid `data:` URLs (e.g. inline images, pdfs) are rejected due to stricter SSRF URL validation in `downloadAssets`.

Since `data:` URLs represent inline data and are not remote resources that need downloading, they should be filtered out from the `plannedDownloads` array altogether rather than being passed into the `download` map.

Changes

  • Updated the filter in `packages/ai/src/prompt/convert-to-language-model-prompt.ts` inside `downloadAssets` to check for `part.data.protocol !== 'data:'` before adding it to `plannedDownloads`.

This fixes an issue introduced in \`@ai-sdk/provider-utils@4.0.19\` where stricter SSRF URL validation caused \`data:\` URLs to be rejected during the \`downloadAssets\` phase, since \`validateDownloadUrl\` only allows \`http:\` and \`https:\`.

Since \`data:\` URLs are inline payloads and don't need actually downloading, they should be filtered out from the \`plannedDownloads\` array altogether.

Fixes vercel#13103
@tigent tigent bot added ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. bug Something isn't working as documented labels Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. bug Something isn't working as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSRF protection in provider-utils@4.0.19 rejects data: URLs in downloadAssets

1 participant