Skip to content

(permissive) request target validation #3373

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
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pajod
Copy link
Contributor

@pajod pajod commented Mar 27, 2025

Gunicorn does not care much about URI parsing, but it probably should not forward things

  • already known to be invalid, and
  • not in common use, and
  • likely to be misinterpreted by consumers (python stdlib is practical, not pure).

Suggested changes:

  • newly reject ASCII controls
  • continue permitting " (quotation mark) and | (vertical line a.k.a pipe)
  • newly reject ASCII <>{}`^\
    • those are never allowed in URIs, but at least {} is used anyway.. in percent-encoded form
    • decision needed, as this is not as obviously confusing URL parsers as NUL bytes are
    • compatibility check for Safari needed, e.g. and watch print(bits[1]) when browsing to
      http://[::1]/a"|<>{}`^\
  • continue permitting upper bytes, deferring interpretation to the application

Ref:

* reject ascii controls
* reject ascii <>{}`^|\
* permit latin-1, including nbsp+shy
* permit " (quotation mark)
@pajod pajod force-pushed the patch-uri-characters branch from d3f12c6 to 2e7e5c1 Compare March 27, 2025 14:09
@pajod pajod mentioned this pull request Apr 8, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gunicorn incorrectly accepts NUL within URIs
1 participant