GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — Reject negative session timeout and cache size in the QUIC SSLSessionContext by Marti2203 · Pull Request #18414 · netty/netty Conversation
Contributor
Motivation:
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 Modification: Check both values with Result: Negative values are rejected with Testing: I ran the client case above against 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…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
enabled auto-merge (squash)
|
There was an error while loading. Please reload this page.
✅ All tests passed ✅🏷️ Commit: b4cf984 Learn more about TestLens at testlens.app/docs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Auto-port PR for 5.0: #18415 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…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]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.