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 — Port 5.0: Include TrustManager / KeyManager instances in TLS session id context computations (#18256) by chrisvest · Pull Request #18283 · netty/netty

Conversation

@chrisvest

@chrisvest chrisvest commented Nov 5, 2026

Copy link
Copy Markdown
Member

Motivation:

The session_id_context fix for GHSA-6xv6-9mgg-mfvc derived the session_id_context from the ClientAuth mode, the certificate chain and the trusted certificates. Configurations backed by a TrustManagerFactory, KeyManagerFactory, TrustManager or KeyManager can not be digested, so a random salt was mixed in for them. That kept them safe, but it also meant sessions could never be resumed between two contexts built from the very same TrustManager / KeyManager objects, such as SNI virtual hosts or a context that is rebuilt to reload certificates.

Comparing such objects by System.identityHashCode is not safe, as identity hash codes are not unique, and a collision would let a session be resumed on a context with a different trust configuration.

Modifications:

  • Add SecureObjectIdentityHash, which associates 256 bits of SecureRandom entropy with the identity of an object, for as long as the object is alive. It uses a new WeakIdentityHashMap, as the JDK has no map with both weak keys and identity semantics (at least not in its public API).
  • Add SessionIdContextBuilder, which digests (SHA-256) a domain separation seed, the ClientAuth mode, the installed OpenSslCredentials, the local identity material (key and certificate chain, or the identity of the KeyManagerFactory / KeyManager) and the trust material (trusted certificates, or the identity of the TrustManagerFactory / TrustManager). When a plain TrustManager / KeyManager is configured, its identity is used instead of the identity of the wrapper factory the builder creates for it, so configuring the same manager twice gives the same result.
  • Let SslContextBuilder and QuicSslContextBuilder record the configured material in a SessionIdContextBuilder, and pass it on to ReferenceCountedOpenSslServerContext, OpenSslServerContext and QuicheQuicSslContext, which use it to set the session_id_context.
  • Contexts created through the deprecated SslContext.newServerContext(...) methods and OpenSslServerContext constructors use a random session_id_context, as before.
  • Deprecate the protected-static SslContext.deriveSessionIdContext(...), which is replaced by SessionIdContextBuilder.
  • Add tests for WeakIdentityHashMap, using IdentityHashMap as an oracle for randomized tests and checking that keys are weakly held, and for SecureObjectIdentityHash.

Result:

Sessions can be resumed between server contexts in the same JVM that use the same TrustManager / KeyManager (or factory) instances and are otherwise configured identically. Contexts that differ in ClientAuth mode, trust or key configuration still get distinct session_id_context values.

Sorry, something went wrong.

Uh oh!

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

All reactions
@chrisvest
Include TrustManager / KeyManager instances in TLS session id context…
9ebe979
… computations (netty#18256)

Motivation:

The session_id_context fix for GHSA-6xv6-9mgg-mfvc derived the
session_id_context from the `ClientAuth` mode, the certificate chain and
the trusted certificates. Configurations backed by a
`TrustManagerFactory`, `KeyManagerFactory`, `TrustManager` or
`KeyManager` can not be digested, so a random salt was mixed in for
them. That kept them safe, but it also meant sessions could never be
resumed between two contexts built from the very same `TrustManager` /
`KeyManager` objects, such as SNI virtual hosts or a context that is
rebuilt to reload certificates.

Comparing such objects by `System.identityHashCode` is not safe, as
identity hash codes are not unique, and a collision would let a session
be resumed on a context with a different trust configuration.

Modifications:

- Add `SecureObjectIdentityHash`, which associates 256 bits of
`SecureRandom` entropy with the identity of an object, for as long as
the object is alive. It uses a new `WeakIdentityHashMap`, as the JDK has
no map with both weak keys and identity semantics (at least not in its
public API).
- Add `SessionIdContextBuilder`, which digests (SHA-256) a domain
separation seed, the `ClientAuth` mode, the installed
`OpenSslCredentials`, the local identity material (key and certificate
chain, or the identity of the `KeyManagerFactory` / `KeyManager`) and
the trust material (trusted certificates, or the identity of the
`TrustManagerFactory` / `TrustManager`). When a plain `TrustManager` /
`KeyManager` is configured, its identity is used instead of the identity
of the wrapper factory the builder creates for it, so configuring the
same manager twice gives the same result.
- Let `SslContextBuilder` and `QuicSslContextBuilder` record the
configured material in a `SessionIdContextBuilder`, and pass it on to
`ReferenceCountedOpenSslServerContext`, `OpenSslServerContext` and
`QuicheQuicSslContext`, which use it to set the `session_id_context`.
- Contexts created through the deprecated
`SslContext.newServerContext(...)` methods and `OpenSslServerContext`
constructors use a random `session_id_context`, as before.
- Deprecate the protected-static
`SslContext.deriveSessionIdContext(...)`, which is replaced by
`SessionIdContextBuilder`.
- Add tests for `WeakIdentityHashMap`, using `IdentityHashMap` as an
oracle for randomized tests and checking that keys are weakly held, and
for `SecureObjectIdentityHash`.

Result:

Sessions can be resumed between server contexts in the same JVM that use
the same `TrustManager` / `KeyManager` (or factory) instances and are
otherwise configured identically. Contexts that differ in `ClientAuth`
mode, trust or key configuration still get distinct `session_id_context`
values.
@chrisvest chrisvest added this to the 5.0.0.Final milestone Nov 5, 2026
@chrisvest chrisvest mentioned this pull request Nov 5, 2026
Include TrustManager / KeyManager instances in TLS session id context computations #18256
Merged
@chrisvest
chrisvest enabled auto-merge (squash) November 5, 2026 18:41
@testlens-app

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

Uh oh!

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

Copy link
Copy Markdown

🚨 All tests passed but jobs failed 🚨

Failed Jobs without Test Failures

❌ Verify native library loading on musl / musl-verify-alpine-aarch64-gcompat
❌ Verify native library loading on musl / musl-verify-alpine-aarch64
❌ Verify native library loading on musl / musl-verify-alpine-x86_64-gcompat
❌ Verify native library loading on musl / musl-verify-alpine-x86_64
❌ Verify native library loading on musl / musl-verify-glibc-control-x86_64

🏷️ Commit: 9ebe979
▶️ Tests: 95203 executed
⚪️ Checks: 20/20 completed

Rerun Controls

Click the checkbox to trigger a rerun:

  • Rerun jobs

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.

@chrisvest
chrisvest merged commit 71e59e3 into netty:5.0 Nov 5, 2026
16 of 21 checks passed

Uh oh!

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

@chrisvest
chrisvest deleted the 5.0-port-pr-18256 branch November 6, 2026 00:47
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

5.0.0.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

1 participant

@chrisvest
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.