Repository navigation
[7.0] Fix macOS TLS certificate validation unit tests - #5056
Conversation
Add the Server Authentication EKU so macOS SSL policy accepts the test certificate on .NET 8 and 9. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the test-only certificate EKU update for macOS TLS compatibility.
No open issues 🎉
What changed in this PR
This test-only follow-up to #4908 updates generated certificates to satisfy macOS TLS policy, allowing the managed SNI certificate-validation tests to exercise hostname validation as intended.
Changes:
- Adds an explicit Server Authentication enhanced key usage (EKU) extension to self-signed test certificates.
- Leaves production validation, test assertions, and public APIs unchanged.
| File | Description |
|---|---|
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/ManagedSni/SniCommonValidateSslServerCertificateTest.cs |
Adds the Server Authentication EKU to the shared certificate fixture for macOS compatibility. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## release/7.0 #5056 +/- ##
===============================================
- Coverage 73.59% 66.81% -6.79%
===============================================
Files 296 291 -5
Lines 43521 66427 +22906
===============================================
+ Hits 32030 44382 +12352
- Misses 11491 22045 +10554
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Add the Server Authentication EKU to the generated test certificates. On macOS, .NET 8/9 otherwise report
RemoteCertificateNameMismatchbecause Apple SSL policy rejects the missing EKU, even when the DNS SAN matches.Test-only change; production validation, assertions, public APIs, and documentation are unchanged.
Issues
Follow-up to #4908.
Testing
Reproduced four failing cases on macOS/.NET 8 before the fix. After the fix, all 33 certificate-validation cases pass on each of .NET 8, 9, and 10 (99 passed, none skipped).
Used the installed SDK 10.0.401 explicitly because the pinned 10.0.109 SDK is unavailable locally:
Result: passed on all three target frameworks. Windows/Linux runs and SQL Server integration tests were not run locally; only the test certificate fixture changed.
Guidelines
Please review the contribution guidelines before submitting a pull request: