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

Use certificate thumbprints from entire chain in SSL_CTX cache #112858

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rzikm
Copy link
Member

@rzikm rzikm commented Feb 24, 2025

Fixes #112856.

Update the SSL context cache to utilize certificate thumbprints from the entire certificate chain. This mimics what we do for MsQuic

private readonly struct CacheKey : IEquatable<CacheKey>

@Copilot Copilot bot review requested due to automatic review settings February 24, 2025 13:15
@rzikm rzikm requested a review from wfurt February 24, 2025 13:16
@rzikm
Copy link
Member Author

rzikm commented Feb 24, 2025

/azp run runtime-libraries-coreclr outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@@ -36,33 +36,62 @@ private sealed class SafeSslContextCache : SafeHandleCache<SslContextCacheKey, S
internal readonly struct SslContextCacheKey : IEquatable<SslContextCacheKey>
{
public readonly bool IsClient;
public readonly byte[]? CertificateThumbprint;
public readonly List<byte[]> CertificateThumbprints;
Copy link
Preview

Copilot AI Feb 24, 2025

Choose a reason for hiding this comment

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

The CertificateThumbprints field is declared as a public readonly List, but the list itself remains mutable. This can lead to unexpected behavior when this key is used in caching or dictionary operations, so consider exposing an immutable collection or making a defensive copy in the constructor.

Suggested change
public readonly List<byte[]> CertificateThumbprints;
public readonly ReadOnlyCollection<byte[]> CertificateThumbprints;

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link
Member

Choose a reason for hiding this comment

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

it seems like simple array would be sufficient as we know the count upfront...

Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

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

LGTM.

@rzikm
Copy link
Member Author

rzikm commented Feb 24, 2025

/azp run runtime-libraries-coreclr outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ShreyasJejurkar
Copy link
Contributor

Nice branch name 😅😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants