Validate `Host` and `Origin` independently in `DnsRebindingProtectionMiddleware`
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
Rechercherichtung
Start by locating DnsRebindingProtectionMiddleware and reading its current handling of the Host and Origin headers. The issue raises two alternative designs and does not identify files or tests; first determine the project’s existing middleware and test conventions. Done means validating Host on every request and, if present, Origin separately with its own allowlist, including scheme and port.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
The current DnsRebindingProtectionMiddleware handles Host and Origin as alternatives:
- If an
Originheader is present, only its hostname is checked. - Otherwise, the
Hostheader is checked. - Both values are checked against the same
allowedHostslist.
This causes several issues:
- An invalid
Hostheader is not rejected when an allowedOriginheader is present. HostandOriginrepresent different parties:Hostidentifies the target MCP server, whileOriginidentifies the web origin initiating the request. They commonly have different values and therefore require separate allowlists.- Origin validation is reduced to the hostname. This makes it impossible to distinguish origins by scheme or port, even though those are part of the web-origin tuple.
Would it make sense to either:
- Split this into separate Host and Origin validation middleware; or
- Extend
DnsRebindingProtectionMiddlewarewith separateallowedHostsandallowedOriginsoptions, validatingHoston every request and additionally validatingOriginwhenever it is present?
I would be happy to submit a pull request if this direction is acceptable.
- Vorherrschende Sprache
- PHP
- Sterne
- 1.6k
- Forks
- 173
- Ø Merge
- 19 Std. 19 Min.
- Gemergte PRs (30 T.)
- 8
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/php-sdk
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
modelcontextprotocol/php-sdk#516 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStanOffenServer
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
modelcontextprotocol/php-sdk#468 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs confirmation needs maintainer action Server
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
modelcontextprotocol/php-sdk#398 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
modelcontextprotocol/php-sdk#370 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 69/100
modelcontextprotocol/php-sdk#521 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in modelcontextprotocol/php-sdk
Ähnliche Issues
-
UX
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
ProfessionalWiki/NeoWiki#1573 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
-
sync-en
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Maintainer antworten meist innerhalb von 1 Tag
-
sync-en
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag