Skip to content

fix(plugins): validate HTTP destinations before dispatch - #3050

Merged
ascorbic merged 6 commits into
emdash-cms:mainfrom
logelog:fix/plugin-http-external-targets
Sep 11, 2026
Merged

ascorbic merged 6 commits into
emdash-cms:mainfrom
logelog:fix/plugin-http-external-targets

Conversation

@logelog

@logelog logelog commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

A plugin's allowedHosts check could accept an internal destination because it checked hostname membership without applying SSRF validation. Redirects to matching hosts had the same gap.

This PR validates the scheme, hostname and resolved addresses before initial requests and each redirect. It preserves host restrictions and cross-origin credential stripping. The shared validator also rejects previously missed non-public IPv4 and IPv6 ranges, so import, media and registry callers receive the same checks.

Ordinary fetch() still resolves the destination separately. DNS rebinding and differences between validation and connection DNS require address pinning or network egress controls. The default resolver uses cloudflare-dns.com; self-hosted deployments must permit that endpoint.

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md.
  • pnpm typecheck passes.
  • pnpm lint passes.
  • Targeted tests pass.
  • Changed files have been formatted.
  • I have added and updated tests.
  • Admin strings are translated: not applicable; no UI changes.
  • I have added and reviewed the changeset.
  • Approved Discussion: not applicable; bug fix.
  • UI screenshots are included: not applicable.

AI-generated code disclosure

  • This PR includes AI-generated code. GPT-5.6.

Screenshots / test output

Not applicable; no UI changes. Coverage includes literal addresses, DNS answers, redirect validation and existing shared-validator callers.

@changeset-bot

changeset-bot Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b23431d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
emdash Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/cloudflare Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
create-emdash Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/release-service Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the review/needs-review No maintainer or bot review yet label Sep 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Scope check

This PR changes 758 lines across 7 files. Large PRs are harder to review and more likely to be closed without review.

If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs.

See CONTRIBUTING.md for contribution guidelines.

@pkg-pr-new

pkg-pr-new Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@3050

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@3050

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@3050

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@3050

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@3050

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@3050

emdash

npm i https://pkg.pr.new/emdash@3050

create-emdash

npm i https://pkg.pr.new/create-emdash@3050

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@3050

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@3050

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@3050

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@3050

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@3050

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@3050

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@3050

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@3050

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@3050

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@3050

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@3050

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@3050

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@3050

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@3050

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@3050

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@3050

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@3050

commit: 1e6ab13

@ascorbic
ascorbic enabled auto-merge (squash) September 11, 2026 13:14
@ascorbic
ascorbic merged commit 4c89130 into emdash-cms:main Sep 11, 2026
53 checks passed
@emdashbot emdashbot Bot mentioned this pull request Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core review/needs-review No maintainer or bot review yet size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants