Fix macOS CI: avoid empty-KeyUsage test cert#3953
Merged
Merged
Conversation
The macOS Core test job failed with AppleCommonCryptoCryptographicException 'Unknown format in import' when loading a certificate built with an empty X509KeyUsageExtension (X509KeyUsageFlags.None -> zero-bit BIT STRING). Drop the degenerate empty-KeyUsage test cert: the truly-absent-KeyUsage case (built via CertificateRequest) already covers the GetKeyUsage()==None path, and the reject/suppress integration tests now use a present-but-insufficient DigitalSignature KeyUsage. Verified on Windows and Linux.
romanett
approved these changes
Jul 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Fixes macOS CI failures in issuer/CA KeyUsage validation tests by avoiding generation of non-standard “empty KeyUsage” test certificates that AppleCrypto refuses to import.
Changes:
- Removes the test case that creates a CA certificate with a present-but-zero KeyUsage extension.
- Uses an omitted-KeyUsage CA certificate to cover the
GetKeyUsage() == Nonepath without the degenerate encoding. - Updates reject/suppress integration tests to use a macOS-loadable but insufficient KeyUsage (
DigitalSignature) for the issuer.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master378 #3953 +/- ##
=============================================
+ Coverage 60.15% 60.18% +0.02%
=============================================
Files 378 378
Lines 79082 79082
Branches 13840 13840
=============================================
+ Hits 47574 47595 +21
+ Misses 27088 27065 -23
- Partials 4420 4422 +2 🚀 New features to boost your workflow:
|
This was referenced Jul 10, 2026
Open
Closed
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.
Summary
Follow-up to #3948 (merged) that fixes a macOS-only CI failure introduced by the issuer/CA KeyUsage tests.
On the macOS Core test job, three tests failed with:
The affected tests built a test CA with an empty KeyUsage extension (
new X509KeyUsageExtension(X509KeyUsageFlags.None, true)→ a zero-bitBIT STRING). Windows (CryptoAPI) and Linux (OpenSSL) load such a certificate, but macOS (AppleCrypto) rejects it as an unknown format. The production code is unaffected — this is purely a test-certificate artifact.Changes
CertificateRequestso no KeyUsage extension is emitted) already covers theGetKeyUsage() == Nonecode path.DigitalSignatureKeyUsage (a valid, macOS-loadable certificate that is still missingkeyCertSign/cRLSign).Testing
CertificateValidatorIssuerKeyUsage tests pass on Windows and Linux (net10.0). The change directly removes the macOS root cause (the empty-KeyUsage extension); all remaining test certificates use standard formats that macOS already loads (the compliant-CA test passed on macOS).Relates to #3944 · follow-up to #3948