This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 0bcc24686f Improve trailer allowed list check
0bcc24686f is described below
commit 0bcc24686f75d43670b6adc407b0a6842aad4018
Author: remm <[email protected]>
AuthorDate: Tue May 19 14:26:41 2026 +0200
Improve trailer allowed list check
Otherwise, cookie, host and priority could be set through the trailers.
---
java/org/apache/coyote/http2/Stream.java | 8 +++++---
webapps/docs/changelog.xml | 3 +++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/coyote/http2/Stream.java
b/java/org/apache/coyote/http2/Stream.java
index 19e306594e..932b5a3de8 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -375,6 +375,11 @@ class Stream extends AbstractNonZeroStream implements
HeaderEmitter {
headerState = HEADER_STATE_REGULAR;
}
+ if (headerState == HEADER_STATE_TRAILER &&
!handler.getProtocol().isTrailerHeaderAllowed(name)) {
+ // Processing trailers and the header is not in the allowed list
+ return;
+ }
+
switch (name) {
case ":method": {
if (coyoteRequest.getMethod() == null) {
@@ -489,9 +494,6 @@ class Stream extends AbstractNonZeroStream implements
HeaderEmitter {
break;
}
default: {
- if (headerState == HEADER_STATE_TRAILER &&
!handler.getProtocol().isTrailerHeaderAllowed(name)) {
- break;
- }
if ("expect".equals(name) && "100-continue".equals(value)) {
coyoteRequest.setExpectation(true);
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 48ca07d352..00188a9dd4 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -149,6 +149,9 @@
Ensure that malformed HTTP/2 messages that should trigger a stream
reset
do so, rather than triggered a connection close. (markt)
</fix>
+ <fix>
+ Improve enforcement of header trailer allow list for HTTP/2. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Cluster">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]