CheckTrustedIssuer: Fixes for invalid chains by NickCraver · Pull Request #2665 · StackExchange/StackExchange.Redis

@NickCraver

This issue was brought to my attention last night (thanks reporter!): dotnet/dotnet-api-docs#6660

This changeset ensures that we do not honor self-signed certs or partial/broken chains as a result of `X509VerificationFlags.AllowUnknownCertificateAuthority` downstream and adds a few tests and utilities to generate test certificates (currently valid for ~9000 days). Instead we are checking that the certificate we're being told to trust is explicitly in the chain, given that the result of `.Build()` cannot be trusted for this case.

@NickCraver

mgravell

mgravell

mgravell

mgravell

@NickCraver

@NickCraver

vcsjones

bartonjs

bartonjs

bartonjs

bartonjs

bartonjs

bartonjs

bartonjs

bartonjs

vcsjones

@NickCraver

mgravell

philon-msft

bartonjs

bartonjs

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>

@NickCraver

NickCraver added a commit that referenced this pull request

Mar 12, 2024
Further hardening following #2665. This is an additional check to match the .NET implementation for TLS cert checks so that we don't treat a cert flagged as non-TLS-server effectively. This ensures that a certificate either doesn't have OIDs here (valid, backwards compatible) or has the server-certificate OID indicating it's valid for consumption over TLS for us.

Cheers @bartonjs for the report and info here.