-
Notifications
You must be signed in to change notification settings - Fork 150
[CVE-2024-6844] Replace use of (urllib) unquote_plus with unquote #389
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
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
I've been trying to understand how this is not appropriate for paths, and have found nothing stating this in any RFC's... Is it because it is omitted in https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.2 that you believe it is not appropriate, or is that called out explicitly anywhere? Is there more specific text in any RFC you can point to which explicitly says that this is the case? There is some old Java notes: https://blog.lunatech.com/posts/2009-02-03-what-every-web-developer-must-know-about-url-encoding which states the above position, but it's not referenced anywhere officially, so I feel like it has very little to do with HTTP specification. Thanks for doing this; I would just like to understand more about how the commit |
First, thank you very much for the contribution and fix! I really appreciate the help and support maintaining this library. Second, can you please add unit tests to codify the behavior? If you are able to add some tests to verify the new behavior, I'll happily merge! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add unit tests!
@LewisCowlesMotive I mostly went off of confidence of knowing that the But for paths the plus sign is a valid character e.g. With respect to actual evidence, the authoritative spec for URI syntax is RFC 3986:
From Section 3.3 - definition of a
Each
and:
From section 2.3 - definition of a
Here it is: + is explicitly listed as a sub-delimiter. Since Therefore, the + character is valid and allowed in path segments. |
d3f85dc
to
ed83b74
Compare
Hey @corydolphin -- some unit tests added. I ran the tests with the old code (e.g.
|
This is great thank you. I read the spec. I Think I understand your point better now. Initially I read it as plus should not be in paths. I then re-read it and read up on it's origin from browsers. So while folks might be able to interpret the path, it's non-standard and nothing to do with HTTP or CORS. Thanks. |
Hi @corydolphin, how's it going? Would you be able to merge this lil guy and cut a new release? Otherwise, any other tests you would like to see? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the discussion and fixes! You all make software development great!
@LewisCowlesMotive let me know if you are interested in becoming a maintainer and we can discuss transition processes. I frankly don’t focus on Flask and may no longer be the best person to maintain this.
Hey @corydolphin, I assume you meant to tag me? If so -- I would be interested in sharing the burden but not entirely taking it over. I'll send you an email to follow up outside of this PR. |
[CVE-2024-6844] Replace use of (urllib) unquote_plus with unquote
The unquote_plus function was being used here to normalize the request path before applying pattern matching against defined CORS resources.
BUT
unquote_plus()
decodes+
signs into spaces, which is NOT appropriate for URL paths. The + character is not reserved in URL paths — it can be a valid part of the path.So we want to use
unquote
instead ofunquote_plus
(which does not decode+
into spaces.