Skip to content

Extra Header Validation - #26115

Open
Pandrex247 wants to merge 1 commit into
eclipse-ee4j:mainfrom
Pandrex247:Extra-Header-Validation
Open

Extra Header Validation#26115
Pandrex247 wants to merge 1 commit into
eclipse-ee4j:mainfrom
Pandrex247:Extra-Header-Validation

Conversation

@Pandrex247

Copy link
Copy Markdown
Contributor

Signed-off-by: Andrew James Pielage <andrew.pielage@azul.com>
@OndroMih

OndroMih commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Hi @Pandrex247, which issue does this address? Grizzly should handle this already by ignoring Conten-tLength header if Transfer-Encoding header is present, as explained in eclipse-ee4j/glassfish-grizzly#2237 you linked. Is there a reason why GlassFish needs this validation on top of Grizzly and refuse requests with both headers instead of just ignoring the Content-Length header?

@Pandrex247

Copy link
Copy Markdown
Contributor Author

Grizzly itself does, but not necessarily Payara/GlassFish. This is stricter validation.
We had a reproducer very similar to one of the recent CVE fixes that Grizzly wasn't catching (I previously left a comment on the issue in GitLab)

@OndroMih

Copy link
Copy Markdown
Contributor

@Pandrex247 , I replied to you on Gitlab: https://gitlab.eclipse.org/security/vulnerability-reports/-/work_items/293#note_7934313

In short, I believe that the fix in Grizzly is enough and it works in GlassFish 8.0.3, this this PR is not needed. It adds a performance penalty and I don't see how it addresses any issue that isn't already addressed.

@dmatej

dmatej commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Can we close this? The fix was distributed with Grizzly 5.0.2 and GlassFish 8.0.3. Basically it is enabled the strict validation by default, while older releases were benevolent by default. The extra validation seems redundant to me now.

@OndroMih

OndroMih commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

I understand now.

Grizzly now addresses the issue by ignoring the Content-Length header and continues processing.

This PR for GlassFish instead raises an error in this situation and doesn't continue processing. This is explained in https://gitlab.eclipse.org/security/vulnerability-reports/-/work_items/293#note_8157118

The RFC explicitly says that the Content-Length header should be ignored, but also strongly suggests raising an error instead of processing normally without the Content-Length header.

So the solution proposed here is more robust, however it introduces performance penalty because the check happens for every request and is not very cheap.

final HttpRequestPacket request = (HttpRequestPacket) httpHeader;

// Here we can add extra validation to prevent Http Server invalid use of headers
if (request.containsHeader(Header.ContentLength) && request.containsHeader(Header.TransferEncoding)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be a valid check because Grizzly always computes the value of the Content-Length header from the content so I believe that request.containsHeader(Header.ContentLength) always returns true. That would lead to refusing all requests that contain Transfer-Encoding header.

See: https://github.com/eclipse-ee4j/glassfish-grizzly/blob/52ef17dfe6d5f71016d7584d3f92c2157af3739b/modules/http/src/main/java/org/glassfish/grizzly/http/HttpHeader.java#L901

@Pandrex247, can you verify that correct requests with just the Transfer-Encoding are not always refused?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants