-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
Fix x-www-form-urlencoded parsing for no-value key (re-submission) #13908
Merged
normanmaurer
merged 5 commits into
netty:4.1
from
jeremyg484:form-urlencoded-empty-key-parsing
Mar 15, 2024
Merged
Fix x-www-form-urlencoded parsing for no-value key (re-submission) #13908
normanmaurer
merged 5 commits into
netty:4.1
from
jeremyg484:form-urlencoded-empty-key-parsing
Mar 15, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Motivation: According to the specification for parsing of application/x-www-form-urlencoded content at https://url.spec.whatwg.org/#application/x-www-form-urlencoded, a key without an = should be able to be parsed and given an empty value. The current implementation of HttpPostStandardRequestDecoder fails to parse these no-value keys when they are the last value in the sequence. Modifications: HttpPostStandardRequestDecoder is modified to include a key with no value that is at the end of the undecoded chunk in the existing "special empty FIELD" code path that currently only handles such fields when they are followed by a '&' character. Additional tests are provided to throroughly exercise variations of content bodies with such empty fields. Result: Keys with no value that appear at the end of a x-www-form-urlencoded sequence will be parsed according to the spec.
@yawkat PTAL |
yawkat
approved these changes
Mar 15, 2024
@yawkat @jeremyg484 thanks a lot! |
thanks! |
also, this seems like a prime target for fuzzing. if i ever get approval to work on that... |
gniadeck
added a commit
to gniadeck/netty
that referenced
this pull request
Apr 23, 2024
Motivation: This is a fix for issue netty#13981 that reports a changed behaviour of HttpPostStandardRequestDecoder after this PR - netty#13908 Because HttpPostStandardRequestDecoder changed the contract, some code implementations relying on certain parsing are failing Modification: This PR makes sure, that the edge case handling for form data happenes only when the content is in fact form data Result: Fixes netty#13981
normanmaurer
pushed a commit
that referenced
this pull request
Apr 27, 2024
Motivation: This is a fix for issue #13981 that reports a changed behaviour of HttpPostStandardRequestDecoder after this PR - #13908 Because HttpPostStandardRequestDecoder changed the contract, some code implementations relying on certain parsing are failing Modification: This PR makes sure, that the edge case handling for form body happenes only when the content is in fact form body Result: Fixes #13981
normanmaurer
pushed a commit
that referenced
this pull request
Apr 27, 2024
Motivation: This is a fix for issue #13981 that reports a changed behaviour of HttpPostStandardRequestDecoder after this PR - #13908 Because HttpPostStandardRequestDecoder changed the contract, some code implementations relying on certain parsing are failing Modification: This PR makes sure, that the edge case handling for form body happenes only when the content is in fact form body Result: Fixes #13981
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
According to the specification for parsing of
application/x-www-form-urlencoded content at
https://url.spec.whatwg.org/#application/x-www-form-urlencoded, a key
without an = should be able to be parsed and given an empty value. The
current implementation of HttpPostStandardRequestDecoder fails to parse
these no-value keys when they are the last value in the sequence.
Modifications:
HttpPostStandardRequestDecoder is modified to include a key with no
value that is at the end of the undecoded chunk in the existing "special
empty FIELD" code path that currently only handles such fields when they
are followed by a '&' character.
Additional tests are provided to throroughly exercise variations of
content bodies with such empty fields.
A test has also been added to verify that the change works with an empty
last chunk, as suggested in the original PR #13904
Result:
Keys with no value that appear at the end of a x-www-form-urlencoded
sequence will be parsed according to the spec.