Open
Description
β 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