Skip to content

Handle missing Network.framework peer certificate chain#127451

Merged
liveans merged 1 commit intodotnet:mainfrom
liveans:fix-networkframework-null-peer-chain
Apr 27, 2026
Merged

Handle missing Network.framework peer certificate chain#127451
liveans merged 1 commit intodotnet:mainfrom
liveans:fix-networkframework-null-peer-chain

Conversation

@liveans
Copy link
Copy Markdown
Member

@liveans liveans commented Apr 27, 2026

Fixes crash in #123395

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a crash in Apple Network Framework TLS/WebSockets scenarios by safely handling cases where the peer certificate chain handle is missing/invalid, avoiding a NullReferenceException during remote certificate extraction.

Changes:

  • Make the Network.framework peer chain handle nullable when retrieving the remote certificate.
  • Early-return null when the chain handle is missing or invalid, preventing calls into AppleCrypto with a null handle.
  • Ensure the copied certificate chain handle is disposed when it was created via SslCopyCertChain (SafeDeleteSslContext path), even on the early-return path.

@liveans liveans merged commit ea83ba3 into dotnet:main Apr 27, 2026
92 of 97 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants