Repository navigation
Preserve TLS channel binding when forwarding client certificates - #69982
Open
GrantTotinov wants to merge 1 commit into
Open
GrantTotinov wants to merge 1 commit into
GrantTotinov wants to merge 1 commit into
Conversation
CertificateForwardingMiddleware and IISMiddleware replace the request's ITlsConnectionFeature when a client certificate header is present. The replacement features did not implement TryGetChannelBindingBytes, so the default interface implementation returned false and Negotiate silently ran without channel binding on HTTPS requests. The replacement features now delegate TryGetChannelBindingBytes to the server's original feature. The Kestrel ClientCertBufferingFeature sample delegates too, the ITlsConnectionFeature docs state the delegation requirement, and NegotiateHandler logs at debug level when an HTTPS request has no channel binding. Fixes dotnet#69649
GrantTotinov
requested review from
BrennanConroy,
SamMonoRT,
Youssef1313,
cincuranet,
davpetr,
halter73 and
rokonec
as code owners
October 23, 2026 01:55
Contributor
|
Thanks for your PR, @GrantTotinov. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Contributor
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Preserve TLS channel binding when forwarding client certificates
Keep TLS channel binding when the client cert feature is replaced
Description
When a client certificate header is present,
CertificateForwardingMiddlewareandIISMiddlewareswap in their ownITlsConnectionFeature. Neither replacement implementedTryGetChannelBindingBytes, so the default interface method returnedfalseand Negotiate quietly ran without channel binding on HTTPS requests that did have one.Changes:
CertificateForwardingFeatureandForwardedTlsConnectionFeaturenow keep the feature they replace and delegateTryGetChannelBindingBytesto it. With no original feature they returnfalseand an empty token. Both types are internal, so there's no public API change.ClientCertBufferingFeaturesample delegates the method as well.ITlsConnectionFeature.TryGetChannelBindingBytesnow say that wrappers/replacements must delegate.NegotiateHandlerlogs at debug level (ChannelBindingUnavailable) when an HTTPS request has no channel binding, so the degraded mode is visible.Tests:
CertificateForwardingTestsandIISMiddlewareTests: delegation to a fake original feature, plus the no-original-feature case.NegotiateHandlerTests:UseCertificateForwarding()before authentication with the header present, asserting the state gets the connection's binding (fails without the fix). The existing no-binding theory now also checks the new log.About proxies that present a different certificate
The only case that behaves differently is when the app server itself terminates TLS behind a proxy that uses a different certificate, and the cert header is present. Those setups already fail Negotiate with channel binding today for any request without the header, because the client binds to the proxy's certificate. They only "worked" when the header happened to be there and the binding got dropped. After this change the result no longer depends on the header. When the proxy forwards plain HTTP to the app (including IIS out-of-process), there's no original TLS feature and nothing changes.
I didn't add an opt-out since it would be new public API whose only job is to turn the protection off. A short docs note that channel binding needs the app server to terminate the client's TLS (or share the proxy's certificate) seems like enough to me, especially since this is all new in 11.0 and hasn't shipped in GA yet. Happy to add a breaking-change note instead if you think it's warranted.
Fixes #69649