Conversation
…ny cert has it Co-authored-by: danegsta <50252651+danegsta@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13667Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13667" |
There was a problem hiding this comment.
Pull request overview
This PR implements a fix for filtering developer certificates to ensure that when any certificate has an X509SubjectKeyIdentifier extension, only certificates with this extension are included in the final trust set. This prevents legacy certificates without SKI from causing conflicts in OpenSSL certificate validation.
Key Changes
- Extracted certificate filtering into an intermediate
validCertslist to enable conditional filtering before grouping - Added logic to check if any valid certificate has a Subject Key Identifier extension
- If SKI is present on any certificate, filters out all certificates without it
| // If any certificate has a Subject Key Identifier extension, exclude certificates without it | ||
| if (validCerts.Any(c => c.HasSubjectKeyIdentifier())) | ||
| { | ||
| validCerts = validCerts.Where(c => c.HasSubjectKeyIdentifier()).ToList(); | ||
| } |
There was a problem hiding this comment.
The new filtering logic that excludes certificates without Subject Key Identifier when at least one certificate has it lacks test coverage. Consider adding unit tests that verify the filtering behavior with scenarios such as:
- All certificates have SKI: all should be included
- Some certificates have SKI, some don't: only those with SKI should be included
- No certificates have SKI: all should be included
- Mixed valid/invalid SKI values
This would ensure the filtering logic works correctly across different certificate store states.
There was a problem hiding this comment.
I'm not quite ready to add tests that write certificates to the store to make these tests viable.
|
Confirmed this works |
|
@danegsta What happens if they only have an older dev cert? |
If there’s only older dev certs (pre-10.0.101 patch), we’ll only trust a single older cert (the newest one). If there’s multiple certs from 10.0.101 or newer we can safely trust all of them. |
|
/backport to release/13.1 |
|
Started backporting to release/13.1: https://github.com/dotnet/aspire/actions/runs/20414391919 |
Description
When loading developer certificates, if any certificate contains an X509SubjectKeyIdentifierExtension, exclude all certificates lacking this extension from the trust set. This prevents conflicts between legacy certificates and modern SKI-enabled certificates, particularly with OpenSSL's first-match validation behavior.
Changes:
DeveloperCertificateService.cscertificate loading logic to filter certificates based on SKI extension presenceImplementation:
Checklist
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.