Skip to content

[creds]: Accept ECDSA server certs in preferredCipherSuites#92

Open
parinmaru2 wants to merge 1 commit into
temporalio:mainfrom
parinmaru2:pmaru/accept-ecdsa-server-certs
Open

[creds]: Accept ECDSA server certs in preferredCipherSuites#92
parinmaru2 wants to merge 1 commit into
temporalio:mainfrom
parinmaru2:pmaru/accept-ecdsa-server-certs

Conversation

@parinmaru2

Copy link
Copy Markdown

Summary

Add TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 and TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 to preferredCipherSuites in internal/transport/creds/tls.go.

Until now preferredCipherSuites listed only ECDHE_RSA variants, so TLS.Validate() — via UsesSecureCertificateAlgorithm(preferredCipherSuites...) in internal/transport/creds/validation.go — rejected any server credential whose leaf uses an ECDSA key with:

key type "ecdsa" incompatible with allowed cipher suites

That's a real deployment blocker for identity systems that issue ECDSA leaves by default. Adding the two ECDHE_ECDSA_AES_GCM suites is the minimum change to accept ECDSA leaves without loosening any other property of the negotiated session:

  • Still ECDHE (forward secrecy).
  • Still AES-GCM (authenticated encryption).
  • Still TLS 1.2 minimum; TLS 1.3 negotiation is unchanged (Go doesn't let this field control it).
  • No new key exchanges (no static-RSA, no CBC, no ChaCha20 additions).

So this widens the set of acceptable leaf key types on the server side without widening the negotiation surface.

Test plan

  • go test ./internal/transport/creds/... — passes locally.
  • Updated the existing TestTLS_Validate subtest for ECDSA:
    renamed "ECDSA cert rejected by RSA-only cipher suites""ECDSA cert accepted", replaced the require.ErrorContains(err, "key type") assertion with require.NoError(...).
  • Dropped a now-inaccurate // preferredCipherSuites are RSA-only comment on the RSA-cert subtest.
  • go vet ./internal/transport/creds/... clean.

Notes for reviewers

  • No production code paths changed besides the cipher-suite slice literal.
  • HasSufficientKeySize in internal/transport/creds/validation.go already accepted ECDSA keys (min 256-bit curve) — that path was reachable but only via a non-empty allowedSuites set that included at least one ECDSA suite, which is why it hadn't been triggered by prior tests.
  • MTLS.Validate() also feeds preferredCipherSuites into UsesSecureCertificateAlgorithm (see internal/transport/creds/mtls.go), so mTLS server-side validation gets the same fix for free.

@parinmaru2
parinmaru2 requested review from a team and pseudomuto as code owners July 25, 2026 06:36
@CLAassistant

CLAassistant commented Jul 25, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@parinmaru2
parinmaru2 force-pushed the pmaru/accept-ecdsa-server-certs branch 2 times, most recently from 0a702cb to ec85d0c Compare July 25, 2026 06:46
@parinmaru2 parinmaru2 closed this Jul 25, 2026
@parinmaru2
parinmaru2 force-pushed the pmaru/accept-ecdsa-server-certs branch from ec85d0c to 9264c19 Compare July 25, 2026 06:50
Add TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 and _128_GCM_SHA256 to the
preferred TLS 1.2 cipher suite list. Until now only ECDHE_RSA suites
were allowed, so Validate() rejected any server credential whose leaf
uses an ECDSA key with `key type "ecdsa" incompatible with allowed
cipher suites`. Thats a real deployment blocker for identity systems
that issue ECDSA leaves by default.

Both suites still require ECDHE for forward secrecy and AES-GCM for
authenticated encryption, so this only widens the set of acceptable
leaf key types - not the negotiation surface. Update the ECDSA
subtest and drop a now-inaccurate "RSA-only" comment on the RSA case.
@parinmaru2 parinmaru2 reopened this Jul 25, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.95%. Comparing base (9264c19) to head (0c87af0).
⚠️ Report is 42 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #92      +/-   ##
==========================================
+ Coverage   85.60%   87.95%   +2.34%     
==========================================
  Files          33       63      +30     
  Lines        1042     2723    +1681     
==========================================
+ Hits          892     2395    +1503     
- Misses        128      250     +122     
- Partials       22       78      +56     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

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

Hey @parinmaru2, thanks for the PR!

Adding ECDSA is a straight win IMO, and this LGTM 👍 Once you sign the CLA, I'll get this merged.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants