-
Notifications
You must be signed in to change notification settings - Fork 521
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
NPE in param parsing middleware on certain query strings #243
Comments
Thanks for the report. I believe the |
That sounds fine to me, but the cause of the crash is nil map keys, not nil map values. You can construct a query string that causes the crash by producing a (codec/form-decode "%\"%6346#%#=x") ;=> {nil "x"} |
Or maybe I'm misunderstanding what you meant by "keys that have invalid (nil) values" and "a key that points to an invalid value". |
Oh, well, everything I said goes double for |
Might be fixed by ring-clojure/ring-codec#8. That PR seems to have missed out on a release, so I'll go and release Ring-Codec 1.0.1 and see if that helps. |
I'm not seeing how (try
(URLDecoder/decode encoded (or encoding "UTF-8"))
(catch Exception _ nil))) (I don't understand why ring-codec implements its own url encoding/decoding but also uses |
Yes, you're right about that PR. The In case you're interested, the reason Ring-Codec has both (codec/url-decode "foo+bar")
=> "foo+bar"
(codec/form-decode "foo+bar")
=> "foo bar" The |
I just ran into this with a URI of the form
|
Proposed solution for this here: ring-clojure/ring-codec#25 |
From my perspective, this issue was resolved with ring-clojure/ring-codec#25. Close? /cc @cespare |
We occasionally get NPEs in ring's middleware parsing code when we get certain malformed query strings (or post bodies).
Here's a small example:
The problem arises because
wrap-params
creates a:params
map with a nil key and thenwrap-nested-params
crashes when it sees that.I'm not sure whether
wrap-params
should never produce a nil key, or whetherwrap-nested-params
should ignore nil keys (or both).The text was updated successfully, but these errors were encountered: