dotnet / dotnet/aspnetcore

gRPC AuthContext: SAN dNSName extraction relies on parsing X509Extension.Format() text instead of typed API

Open Beginner friendly
#69,169 1 comment 0 reactions 0 assignees View on GitHub
area-grpc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

[`X509CertificateHelpers.GetDnsFromExtensions`](https://github.com/dotnet/aspnetcore/blob/67a02a66a21ac4f2e8ab19201b59cf45e97c8c98/src/Grpc/JsonTranscoding/src/Shared/X509CertificateHelpers.cs#L38) extracts SAN `dNSName` values by calling `X509Extension.Format(false)` and string-splitting the result, instead of parsing the extension's structured ASN.1 content. `Format()` returns a human-readable, OS/culture-dependent string, and a `dNSName` value could itself contain characters like `,` or `=` that collide with the delimiters this code assumes (e.g. `", "`, `"DNS Name="`/`"DNS:"`). Since .NET 9, `X509SubjectAlternativeNameExtension.EnumerateDnsNames()` parses the extension's DER content directly and should be used instead.

Contributor guide

Open the contributing guide

Research direction

Start in src/Grpc/JsonTranscoding/src/Shared/X509CertificateHelpers.cs at GetDnsFromExtensions, then review X509SubjectAlternativeNameExtension. Replace the text-based SAN extraction with the typed EnumerateDnsNames() API described in the issue. Done means DNS names are obtained from the extension's structured content without relying on Format() or delimiter parsing.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
authentication, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.