Fish 9690 filtering incorrect characters from header rfc 9110 #41
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.
This is a PR to include new properties on the grizzly implementation to enable Header Name and Header Value validation against invalid characters mentioned on the RFC-9110, here the reference of the reported issue: Glassfish issue and here the reserved CVE CVE-2024-45687
To test this set the dependency version on the payara server: 2.3.31.payara-p5 build and run
deploy the following reproducer:
MinimalTest.zip
after starting the server set the following properties on the Payara configuration. You can do it by console ui, command line or directly on the domain.xml file:
asadmin create-jvm-options --target=server-config "-Dorg.glassfish.grizzly.http.STRICT_HEADER_NAME_VALIDATION_RFC_9110\=true"
asadmin create-jvm-options --target=server-config "-Dorg.glassfish.grizzly.http.STRICT_HEADER_VALUE_VALIDATION_RFC_9110\=true"
after adding the properties you need to restart the server
by default on the grizzly side those properties are set as false
deploy the reproducer and make curl calls
Header Name Validation tests:
the result of any of those test should be error 400:
Header Value Validations tests:
curl -i -v -H $'X-MyHeader: he\nllo' http://localhost:8080/MinimalTest/
curl -i -v -H $'X-MyHeader: he\rllo' http://localhost:8080/MinimalTest/
curl -i -v -H $'X-MyHeader: he\0llo' http://localhost:8080/MinimalTest/
In the case of header validation we can't be very strict on the validation that is why the \n is permitted an is evaluated as a new line on the content for the header value and the \0 is immediately not processed from curl because by default we can't consider that character on the request headers and the \r character can be included as a character on the header values and this will be rejected