Skip to content

[Server] Add DNS rebinding protection feature with middleware#260

Open
chr-hertel wants to merge 1 commit intomainfrom
dns-rebinding-protection
Open

[Server] Add DNS rebinding protection feature with middleware#260
chr-hertel wants to merge 1 commit intomainfrom
dns-rebinding-protection

Conversation

@chr-hertel
Copy link
Copy Markdown
Member

@chr-hertel chr-hertel commented Mar 10, 2026

Adding HTTP middleware for DNS middleware protection - following conformance requirements.

  • need to review myself first

@chr-hertel chr-hertel added the Server Issues & PRs related to the Server component label Mar 10, 2026
@chr-hertel chr-hertel marked this pull request as draft March 10, 2026 23:36
@chr-hertel chr-hertel self-assigned this Mar 10, 2026
@chr-hertel chr-hertel requested a review from Copilot March 10, 2026 23:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a server-side HTTP middleware to mitigate DNS rebinding attacks by validating Host and Origin headers against an allowlist, and wires it into the conformance test server to satisfy the conformance suite requirement.

Changes:

  • Introduces DnsRebindingProtectionMiddleware for Host/Origin allowlist validation (defaulting to localhost variants).
  • Adds unit tests covering allow/deny behavior, case-insensitivity, and custom allowlists.
  • Enables the middleware in the conformance server and updates docs/changelog accordingly.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Server/Transport/Http/Middleware/DnsRebindingProtectionMiddleware.php Implements DNS rebinding protection by rejecting non-allowed Host/Origin.
tests/Unit/Server/Transport/Http/Middleware/DnsRebindingProtectionMiddlewareTest.php Unit tests for middleware allow/deny and ordering behavior.
tests/Conformance/server.php Adds the new middleware to the conformance server transport pipeline.
tests/Conformance/conformance-baseline.yml Removes the DNS rebinding protection item from the baseline list.
docs/transports.md Documents how to enable/configure the DNS rebinding middleware.
CHANGELOG.md Notes the addition of DnsRebindingProtectionMiddleware.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chr-hertel chr-hertel force-pushed the dns-rebinding-protection branch 2 times, most recently from 6f8b6ae to 689b0d5 Compare March 31, 2026 19:25
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chr-hertel chr-hertel force-pushed the dns-rebinding-protection branch from 689b0d5 to a933be8 Compare March 31, 2026 19:27
@chr-hertel chr-hertel marked this pull request as ready for review March 31, 2026 19:28
@chr-hertel chr-hertel requested a review from soyuka as a code owner March 31, 2026 19:28
@chr-hertel chr-hertel added the improves spec compliance Improves consistency with other SDKs such as TyepScript label Mar 31, 2026
@chr-hertel chr-hertel added this to the 0.5.0 milestone Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improves spec compliance Improves consistency with other SDKs such as TyepScript Server Issues & PRs related to the Server component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants