8354276: Strict HTTP header validation#24569
8354276: Strict HTTP header validation#24569djelinski wants to merge 15 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back djelinski! A progress list of the required criteria for merging this PR into |
|
@djelinski This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 431 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
@djelinski The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
| of(entry(":status", "200"), entry("hello", "line1\r\n line2\r\n")), // Multiline value | ||
| of(entry(":status", "200"), entry("hello", "DE" + ((char) 0x7F) + "L")), // Bad byte in value | ||
| of(entry(":status", "200"), entry("connection", "close")), // Prohibited connection-specific header | ||
| of(entry(":status", "200"), entry(":scheme", "https")), // Request pseudo-header in response |
There was a problem hiding this comment.
Shouldn't we instead exhaustively test against all hard-coded header collection in ValidatingHeadersConsumer, i.e., PSEUDO_HEADERS and PROHIBITED_HEADERS?
There was a problem hiding this comment.
We could. I don't think it adds much value though.
src/java.net.http/share/classes/jdk/internal/net/http/common/ValidatingHeadersConsumer.java
Outdated
Show resolved
Hide resolved
|
/csr needed |
|
@dfuch has indicated that a compatibility and specification (CSR) request is needed for this pull request. @djelinski please create a CSR request for issue JDK-8354276 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
There will be an observable change of behaviour for clients if for instance, a response contains a |
src/java.net.http/share/classes/jdk/internal/net/http/common/ValidatingHeadersConsumer.java
Show resolved
Hide resolved
Co-authored-by: Michael McMahon <70538289+Michael-Mc-Mahon@users.noreply.github.com>
src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java
Outdated
Show resolved
Hide resolved
src/java.net.http/share/classes/jdk/internal/net/http/common/HeaderDecoder.java
Outdated
Show resolved
Hide resolved
src/java.net.http/share/classes/jdk/internal/net/http/common/ValidatingHeadersConsumer.java
Outdated
Show resolved
Hide resolved
dfuch
left a comment
There was a problem hiding this comment.
LGTM. Please double check that the test still pass after the changes :-)
jaikiran
left a comment
There was a problem hiding this comment.
Thank you Daniel for the updates. This looks good to me.
|
Thanks for the reviews! /integrate |
|
Going to push as commit c94a7ae.
Your commit was automatically rebased without conflicts. |
|
@djelinski Pushed as commit c94a7ae. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
RFC 9113 HTTP/2 mandates certain validation for HTTP headers; the HttpClient don't fully implement the described requirements.
This PR adds the following validation:
Connection headers are still accepted in push promises; that's because some popular server implementations were found to echo the request headers in push promises, and when the original request was a HTTP/1 upgrade, the push promise could contain one or more headers that were prohibited in HTTP/2 but allowed in HTTP/1.
An existing test was adapted to verify the handling of response headers. The modified test passes with this the changes in this PR, fails without them. Other tier1-3 tests continue to pass.
Progress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24569/head:pull/24569$ git checkout pull/24569Update a local copy of the PR:
$ git checkout pull/24569$ git pull https://git.openjdk.org/jdk.git pull/24569/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24569View PR using the GUI difftool:
$ git pr show -t 24569Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24569.diff
Using Webrev
Link to Webrev Comment