Merge pull request #18246 from michaelnebel/csharp/fixwarnings

C#: Fix some new compiler warnings
This commit is contained in:
Michael Nebel
2024-12-12 15:07:23 +01:00
committed by GitHub
4 changed files with 20 additions and 10 deletions

View File

@@ -604,6 +604,16 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
{
httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, _) =>
{
if (chain is null || cert is null)
{
var msg = cert is null && chain is null
? "certificate and chain"
: chain is null
? "chain"
: "certificate";
logger.LogWarning($"Dependabot proxy certificate validation failed due to missing {msg}");
return false;
}
chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust;
chain.ChainPolicy.CustomTrustStore.Add(this.dependabotProxy.Certificate);
return chain.Build(cert);