Skip to content

Handle ECH Retry#9611

Draft
yschimke wants to merge 1 commit into
lysine-dev:masterfrom
yschimke:retry_config
Draft

Handle ECH Retry#9611
yschimke wants to merge 1 commit into
lysine-dev:masterfrom
yschimke:retry_config

Conversation

@yschimke

Copy link
Copy Markdown
Collaborator

No description provided.

@yschimke
yschimke requested a review from swankjesse July 26, 2026 17:18
@yschimke

Copy link
Copy Markdown
Collaborator Author

fun differentPublicHostnameIsVerifiedBeforeRetry() {
// The outer certificate authenticates public.tls-ech.dev,
// so the retry config may be used if it matches.
// https://www.rfc-editor.org/rfc/rfc9849.html#section-6.1.6

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Think I got think backwards, re-reading.

@yschimke

Copy link
Copy Markdown
Collaborator Author

I'll ask at work tomorrow.

@yschimke
yschimke marked this pull request as draft July 26, 2026 17:38

@swankjesse swankjesse left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I’d like to be particularly careful with landing this as it introduces new attack vectors and is not yet possible to test with MockWebServer + JVM Conscrypt.

I think it’s definitely good to have special recovery code for ECH handshake failures. But my first instinct is that special recovery code should mostly be about reducing the opportunity for downgrade attacks.

This is attempting to do something else, and I would like to understand the problem it solves before we land this.

}
}

internal data class EchRetryConfig(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Move this to its own file

Comment on lines +281 to +282
// TODO: Should we treat an untrusted or missing ECH retry config as an ordinary
// SSLException and try another connection spec?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe that if we have ECH information, we shouldn’t let ourselves be downgraded.

@@ -204,7 +211,21 @@ class ConnectPlan internal constructor(
retryTlsConnection = tlsEquipPlan.nextConnectionSpec(connectionSpecs, sslSocket)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we make nextConnectionSpec() accept an EchRetryConfig, rather than having two competing mechanisms for deciding how to retry

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Even better, maybe nextConnectionSpec() should accept an SSLException

val echRetryConfig = Platform.get().getEchRetryConfig(e)
if (
echRetryConfig != null &&
route.address.hostnameVerifier!!.verify(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This surprises me. Is there an attack that this defends against?

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants