Skip to content

Host header is not validatedΒ #646

@kasium

Description

@kasium

❓ I'm submitting a ...

  • 🐞 bug report
  • 🐣 feature request
  • ❓ question about the decisions made in the repository

🐞 Describe the bug. What is the current behavior?
An invalid host header which does not conform idna is just passed to the underlying wsgi application w/o any validation

❓ What is the motivation / use case for changing the behavior?
If the host header contains invalid data, this this data is passed as the HTTP_HOST environment field. It can lead to various issues

πŸ’‘ To Reproduce
Code

from flask import Flask
from cheroot.wsgi import Server

app = Flask(__name__)
server = Server(bind_addr=("localhost", 5001), wsgi_app=app)
server.safe_start()

Now send a request to the server where you set the Host header field to foobar/...

πŸ’‘ Expected behavior
Cheroot declines requests with invalid host header field.

πŸ“‹ Environment

  • Cheroot version: 10.0.0
  • Python version: 3.12.0
  • OS: Linux

πŸ“‹ Additional context
This was already reported to flask pallets/flask#5392

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is brokentriage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions