GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Reject negative session timeout and cache size in the QUIC SSLSessionContext by Marti2203 · Pull Request #18414 · netty/netty

Conversation

@Marti2203

@Marti2203 Marti2203 commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Motivation:

SSLSessionContext.setSessionTimeout(int) and setSessionCacheSize(int) are specified to throw IllegalArgumentException for a negative value, and OpenSslSessionContext does so with checkPositiveOrZero. The QUIC session context (QuicheQuicSslContext$QuicheQuicSslSessionContext) stores the value instead:

SslContext context = QuicSslContextBuilder.forClient().sessionCacheSize(20).sessionTimeout(50).build();
SSLSessionContext sessionContext = context.sessionContext();
sessionContext.setSessionTimeout(-1);     // accepted
sessionContext.getSessionTimeout();       // -1
sessionContext.setSessionCacheSize(-1);   // accepted
sessionContext.getSessionCacheSize();     // -1

A server context passes the value to BoringSSL's SSL_CTX_set_timeout, whose timeout is an unsigned 32-bit value, so a timeout of -1 becomes about 136 years.

Modification:

Check both values with ObjectUtil.checkPositiveOrZero in QuicheQuicSslContext.setSessionTimeout and setSessionCacheSize, before the branch between the Java client session cache and BoringSSL's internal cache, and extend QuicSslContextTest.testSessionContextSettings, which runs for both a client and a server context.

Result:

Negative values are rejected with IllegalArgumentException, as the SSLSessionContext contract and OpenSslSessionContext require, and the previous settings are kept.

Testing: I ran the client case above against codec-classes-quic built from this branch and from current 4.2, with a locally built native QUIC library: before the change both calls are accepted and stored as -1; after it both throw and the values stay 50 and 20. That native library predates a recent JNI addition (SSLContext_setSessionIdContext), so I could not build a server context with it; the server case of the extended test is left to CI. Checkstyle passes.

This issue was found by an LLM-Enhanced Static Analysis Engine and verified manually.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Marti2203
Reject negative session timeout and cache size in the QUIC SSLSession…
b4cf984
…Context

Motivation:

`SSLSessionContext.setSessionTimeout` and `setSessionCacheSize` must
throw `IllegalArgumentException` for a negative value, and
`OpenSslSessionContext` does so with `checkPositiveOrZero`. The QUIC
session context stores the value instead: a client context reports a
timeout and cache size of -1, and a server context passes the value to
BoringSSL's `SSL_CTX_set_timeout`, whose timeout is an unsigned 32-bit
value, so -1 becomes a timeout of about 136 years.

Modification:

Check both values with `ObjectUtil.checkPositiveOrZero` in
`QuicheQuicSslContext`, before the client and server branches, and
extend `QuicSslContextTest`.

Result:

Negative values are rejected with `IllegalArgumentException`, as the
`SSLSessionContext` contract and `OpenSslSessionContext` require.
@normanmaurer
normanmaurer enabled auto-merge (squash) November 14, 2026 09:48
@normanmaurer normanmaurer added the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Nov 14, 2026
@normanmaurer normanmaurer added this to the 4.2.21.Final milestone Nov 14, 2026
@testlens-app

testlens-app Bot commented Nov 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: b4cf984
▶️ Tests: 38530 executed
🟡 Checks: 30/31 completed


Learn more about TestLens at testlens.app/docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
normanmaurer merged commit 887f597 into netty:4.2 Nov 14, 2026
29 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #18415

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot netty-project-bot mentioned this pull request Nov 14, 2026
Auto-port 5.0: Reject negative session timeout and cache size in the QUIC SSLSessionContext #18415
Merged
@github-actions github-actions Bot removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Nov 14, 2026
normanmaurer pushed a commit that referenced this pull request Nov 14, 2026
@netty-project-bot @Marti2203
Auto-port 5.0: Reject negative session timeout and cache size in the …
597aa3a
…QUIC SSLSessionContext (#18415)

Auto-port of #18414 to 5.0
Cherry-picked commit: 887f597

---
Motivation:

`SSLSessionContext.setSessionTimeout(int)` and
`setSessionCacheSize(int)` are specified to throw
`IllegalArgumentException` for a negative value, and
`OpenSslSessionContext` does so with `checkPositiveOrZero`. The QUIC
session context (`QuicheQuicSslContext$QuicheQuicSslSessionContext`)
stores the value instead:

```java
SslContext context = QuicSslContextBuilder.forClient().sessionCacheSize(20).sessionTimeout(50).build();
SSLSessionContext sessionContext = context.sessionContext();
sessionContext.setSessionTimeout(-1);     // accepted
sessionContext.getSessionTimeout();       // -1
sessionContext.setSessionCacheSize(-1);   // accepted
sessionContext.getSessionCacheSize();     // -1
```

A server context passes the value to BoringSSL's `SSL_CTX_set_timeout`,
whose timeout is an unsigned 32-bit value, so a timeout of -1 becomes
about 136 years.

Modification:

Check both values with `ObjectUtil.checkPositiveOrZero` in
`QuicheQuicSslContext.setSessionTimeout` and `setSessionCacheSize`,
before the branch between the Java client session cache and BoringSSL's
internal cache, and extend
`QuicSslContextTest.testSessionContextSettings`, which runs for both a
client and a server context.

Result:

Negative values are rejected with `IllegalArgumentException`, as the
`SSLSessionContext` contract and `OpenSslSessionContext` require, and
the previous settings are kept.

Testing: I ran the client case above against `codec-classes-quic` built
from this branch and from current `4.2`, with a locally built native
QUIC library: before the change both calls are accepted and stored as
-1; after it both throw and the values stay 50 and 20. That native
library predates a recent JNI addition
(`SSLContext_setSessionIdContext`), so I could not build a server
context with it; the server case of the extended test is left to CI.
Checkstyle passes.

This issue was found by an LLM-Enhanced Static Analysis Engine and
verified manually.

Co-authored-by: Martin Mirchev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.2.21.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Marti2203 @netty-project-bot @normanmaurer
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.