Skip to content

Send initialized notification in DNS rebinding scenario - #340

Merged
pcarleton merged 2 commits into
modelcontextprotocol:mainfrom
jstar0:fix/dns-rebinding-initialized
Sep 6, 2026
Merged

Send initialized notification in DNS rebinding scenario#340
pcarleton merged 2 commits into
modelcontextprotocol:mainfrom
jstar0:fix/dns-rebinding-initialized

Conversation

@jstar0

@jstar0 jstar0 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Send notifications/initialized after the DNS rebinding scenario completes a successful dated-spec initialize probe against the valid localhost Host/Origin pair.

Root Cause / Context

The scenario currently performs a valid initialize request for the localhost Host/Origin check, then marks the check successful without completing the dated MCP initialization lifecycle. Servers that require notifications/initialized after a successful initialize can fail or hang even though the Host/Origin validation itself is correct.

Changes

  • Capture the Mcp-Session-Id returned by the valid Host/Origin initialize probe.
  • Send notifications/initialized for dated specs after the valid initialize succeeds, preserving the session id when one is issued.
  • Keep the server/discover path unchanged.
  • Add regressions covering the dated initialized notification sequence and the server/discover no-notification boundary.

Scope / Risk

This only changes the DNS rebinding scenario's valid-host success path. The invalid Host/Origin rejection probe is unchanged, and server/discover traffic still does not send notifications/initialized.

Verification

npm test -- src/scenarios/server/negative.test.ts -t "dns-rebinding-protection"
npm test -- src/scenarios/server/negative.test.ts
npm run typecheck
npm run lint
npm run build
npm test

All commands passed.

Closes #338

@pcarleton
pcarleton enabled auto-merge (squash) September 6, 2026 18:32
@pkg-pr-new

pkg-pr-new Bot commented Sep 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

npx https://pkg.pr.new/@modelcontextprotocol/conformance@340

commit: 3666823

@pcarleton
pcarleton merged commit 8c1d4a6 into modelcontextprotocol:main Sep 6, 2026
4 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.

dns-rebinding-protection client never sends notifications/initialized after a successful initialize (2025-11-25 path)

2 participants