Skip to content

Ensure that browsers never send a malformed request except by explicit request from scripts #1822

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

Open
DemiMarie opened this issue May 7, 2025 · 3 comments

Comments

@DemiMarie
Copy link

What is the issue with the Fetch Standard?

The Fetch Standard allows field values to contain control characters that are not valid in HTTP. In HTTP/2 and later, this makes a request malformed, and servers are required to close the stream. If it is possible for a header that the user agent sends automatically to have an invalid value, this could cause problems. For instance, setting a Cookie header with an invalid value could prevent the user from navigating to a website. Furthermore, the handling of fields with invalid values differs between server implementations: HAProxy and NGINX are permissive, Varnish is strict, and nghttp3 silently discards headers if the field has an invalid value. Envoy goes further and closes the entire connection.

To avoid such problems, it would be best to ensure that invalid HTTP field values are only ever sent by explicit request from scripts, and only for fields that scripts have complete control over the values of. This ensures two useful properties:

  1. Requests will always be well-formed unless a script explicitly chooses to make a malformed request.
  2. Regardless of how servers handle malformed values, information that is under the control of the user agent will be received correctly.

If these properties are already ensured, it would be useful to document this.

@annevk
Copy link
Member

annevk commented May 9, 2025

I'm not sure what 2 means, but 1 is ensured. I don't think it has to be stated again however, it already follows from everything that is stated today.

@whatwg whatwg deleted a comment from Ashfitgoc May 10, 2025
@whatwg whatwg deleted a comment from Ashfitgoc May 10, 2025
@DemiMarie
Copy link
Author

I'm not sure what 2 means, but 1 is ensured. I don't think it has to be stated again however, it already follows from everything that is stated today.

2 means that scripts cannot cause forbidden header names to have values that violate RFC9110.

@annevk
Copy link
Member

annevk commented May 11, 2025

I think that also clearly follows from the requirements laid out in the draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants