Skip to content
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

Avoid parsing request body on requests that should not have one #117

Open
Firehed opened this issue Dec 28, 2020 · 0 comments
Open

Avoid parsing request body on requests that should not have one #117

Firehed opened this issue Dec 28, 2020 · 0 comments
Assignees
Labels

Comments

@Firehed
Copy link
Owner

Firehed commented Dec 28, 2020

Related to guzzle/psr7#363:

A server may set an empty Content-type header on request types with no body, e.g. GET (this happens with default fastcgi_params in Nginx). When this occurs, the request will fail and return a 415 since no parser is available for empty content. There should be some guardrails in place to ensure that when a request doesn't (or shouldn't) have a body, we don't try and fail to parse it and subsequently reject an acceptable request.

There's a plethora of ways to approach this. An allow list of request methods seems like a bad choice in case some weird esoteric type comes up. A block list may work. Using the body size (either by the content-length header or strlen) should be safe. It may be enough to simply handle an empty header and treat it as equivalent to not set.

@Firehed Firehed added the bug label Dec 28, 2020
@Firehed Firehed self-assigned this Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant