- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GET requests with content-length result in HTTP 400 #44
Comments
It's more likely that 2 bytes means |
Seems likely! Maybe send() would be a better place to remove the GET body then? |
HTTP GET generally does not contain a request payload and GET request payload can sometimes be abused in request smuggling attacks. For this (and other) reasons, lighttpd (by default) rejects GET with request payload (400 Bad Request). However, lighttpd 1.4.54 and later have a configuration option to allow GET with a body, if that is desired: |
Thanks! I'd rather not enable that option for security reasons. |
I'm running a matrix-synapse server with lighttpd. The matrix-telegram bridge would not start. The lighttpd logs show that the bridge attempts a GET request with a message body, which is rejected by lighttpd:
It is possible that other web servers just ignore the message-body and don't throw an error. lighttpd rejects it by design, it is argued that HTTP does not allow it.
The Content-Length of 2 suggests that the body is just an extraneous
\r\n
or so which got in there somehow, possibly as an oversight. As a "quick fix", I just emptied the content of GET requests in api.py around line 145:That does fix the problem, the bridge is running now.
Whether that's a good thing to include in mautrix itself I don't know. Maybe it would be better to find all the places in mautrix-telegram (and possibly other mautrix-* bridges) which include a body in a GET request. But then -- GET with body doesn't make much sense, so maybe you want to just zap it in mautrix api and be done with it.
The text was updated successfully, but these errors were encountered: