Skip to content

[Security] Supporting negotiation of certs based on signing algorithm - #9321

Open
gtcooke94 wants to merge 12 commits into
grpc:masterfrom
gtcooke94:multiple_cert_support
Open

[Security] Supporting negotiation of certs based on signing algorithm#9321
gtcooke94 wants to merge 12 commits into
grpc:masterfrom
gtcooke94:multiple_cert_support

Conversation

@gtcooke94

@gtcooke94 gtcooke94 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

This PR fixes issues where gRPC-Go would not correctly support the negotiation of certs based on signing algorithm when multiple are provided. There is no API change.

In advancedtls.go and sni.go, we now call buildGetCertificates unconditionally as this is where we select the certificate based on the desired SNI and signature algorithm.

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.14%. Comparing base (1ecbd86) to head (c9e3d9b).
⚠️ Report is 40 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9321      +/-   ##
==========================================
+ Coverage   83.11%   83.14%   +0.02%     
==========================================
  Files         423      423              
  Lines       35231    35269      +38     
==========================================
+ Hits        29284    29326      +42     
+ Misses       4432     4430       -2     
+ Partials     1515     1513       -2     

see 50 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@easwars

easwars commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

@gtcooke94 : Could you please get someone from the security team to review this before the grpc team starts looking at this.

Also, is there a gRFC/design that could be linked in the PR description. It is currently quite empty.

@easwars easwars added Type: Feature New features or improvements in behavior Type: Security A bug or other problem affecting security labels Aug 17, 2026
@easwars easwars added this to the 1.84 Release milestone Aug 17, 2026
@gtcooke94

gtcooke94 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Will get the security team to review soon once I finalize a few items

There's no public API change for this, but it's pre-work for post-quantum authenticity support. In fact, it's more of a bug in how we were handling things before, it's just that the use-case of negotiating the signature algorithm was never really used.

@gtcooke94
gtcooke94 requested review from matthewstevenson88 and removed request for matthewstevenson88 August 19, 2026 17:43
if o.IdentityOptions.GetIdentityCertificatesForServer == nil {
var certificates []*tls.Certificate
switch {
case o.IdentityOptions.GetIdentityCertificatesForServer != nil:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To confirm my understanding, there is no production risk associated with this change because the current code requires that o.IdentityOptions.GetIdentityCertificatesForServer is non-nil. And now we are just allowing it to be nil. Is that correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let's discuss in the other comment - this diff looks like more than it is because of a moved switch statement

if o.IdentityOptions.nonNilFieldCount() == 0 {
return nil, fmt.Errorf("needs to specify at least one field in IdentityCertificateOptions")
}
if o.IdentityOptions.Certificates != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't understand how the changes to advancedtls.go and sni.go combine to enable negotiation of certs based on signing algorithm. Can you help explain this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In advancedtls.go and sni.go, we now call buildGetCertificates unconditionally on the server side as this is where we select the certificate based on the desired SNI and signature algorithm.

Previously, if Certificates was provided directly, we would not call buildGetCertificates.
Because we call unconditionally now, I moved the core switch impl into buildGetCertificates so we don't have to call it in each switch block in advancedtls.
buildGetCertificates calls clientHello.SupportsCertificate(cert) on each certificate which is what does the selection/negotiation, returning the first that is supported based on the clientHello (which includes checking signing algorithm).

Fundamentally, this already worked in the case of the identity provider and providing a function. However, if Certificates was provided directly, then this codepath would've been skipped (because buildGetCertificates wasn't callled)

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

Labels

Type: Feature New features or improvements in behavior Type: Security A bug or other problem affecting security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants