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 — Include TrustManager / KeyManager instances in TLS session id context computations by chrisvest · Pull Request #18256 · netty/netty Conversation
Member
Motivation: The session_id_context fix for GHSA-6xv6-9mgg-mfvc derived the session_id_context from the Comparing such objects by Modifications:
Result: Sessions can be resumed between server contexts in the same JVM that use the same
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions… computations 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.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
chrisvest
added a commit
that referenced
this pull request
…id context computations (#18256) (#18283) 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.
1 of 11 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. |