Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/9.0] Fix copying ephemeral keys to keychains #106993

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 26, 2024

Backport of #106973 to release/9.0

/cc @lewing @vcsjones @bartonjs

Customer Impact

  • Customer reported
  • Found internally

Reported by multiple customers in #106775.

Customers that use X509Certificate2.CopyWithPrivateKey will get a CryptographicException on macOS Sequoia, which is currently in beta. This breaks some key development scenarios, like CertificateRequest, which is used by ASP.NET for configuring local development HTTPS certificates.

This is due to Apple changing the behavior of one of their APIs to return a different error code. The change is to handle the new error code, in addition to the old one.

Regression

  • Yes
  • No
  • Reaction to platform changes in new OS version

Testing

Existing unit tests failed on the new macOS version. The tests now pass on macOS Sequoia.

Risk

Low. This adds an extra condition to an error handling path that already existed.

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

Starting on macOS Sequoia, at least in beta, SecKeychainitemCopyKeychain no longer returns errSecNoSuchKeychain for ephemeral keys.
Instead, it returns errSecInvalidItemRef.

This adds the error code in the handling logic for when we need to add an ephemeral key to the target keychain.
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

@lewing
Copy link
Member

lewing commented Aug 27, 2024

@vcsjones can you update the description for these backports

@lewing lewing requested a review from bartonjs August 27, 2024 16:03
@lewing lewing added this to the 9.0.0 milestone Aug 27, 2024
@lewing lewing added the Servicing-consider Issue for next servicing release review label Aug 27, 2024
@lewing
Copy link
Member

lewing commented Aug 27, 2024

cc @jeffschwMSFT @artl93

@jeffhandley
Copy link
Member

Tagging @artl93 for review (and merge) into release/9.0. This reacts to macOS Sequoia changing behavior; our existing unit tests were failing on the platform so no new tests were needed.

Once this is reviewed and merged into release/9.0, we will send [release/8.0-staging] Fix copying ephemeral keys to keychains (#107041) and [release/6.0-staging] Fix copying ephemeral keys to keychains (#107046) to Tactics for servicing consideration.

@artl93 artl93 added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Aug 28, 2024
@artl93 artl93 merged commit 7cf8f4a into release/9.0 Aug 28, 2024
100 of 105 checks passed
@vcsjones vcsjones deleted the backport/pr-106973-to-release/9.0 branch August 28, 2024 15:35
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants