Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
C#: Don't initialise DependabotProxy on Windows or macOS
  • Loading branch information
mbg committed Dec 5, 2024
commit 7369d043ed1e9438e69cf9c4c7b4bdcd988e6465
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@

internal static DependabotProxy? GetDependabotProxy(ILogger logger, TemporaryDirectory tempWorkingDirectory)
{
// Setting HTTP(S)_PROXY and SSL_CERT_FILE have no effect on Windows or macOS,
// but we would still end up using the Dependabot proxy to check for feed reachability.
// This would result in us discovering that the feeds are reachable, but `dotnet` would
// fail to connect to them. To prevent this from happening, we do not initialise an
// instance of `DependabotProxy` on those platforms.
if (SystemBuildActions.Instance.IsWindows() || SystemBuildActions.Instance.IsMacOs()) return null;

// Obtain and store the address of the Dependabot proxy, if available.
var host = Environment.GetEnvironmentVariable(EnvironmentVariableNames.ProxyHost);
var port = Environment.GetEnvironmentVariable(EnvironmentVariableNames.ProxyPort);
Expand Down Expand Up @@ -58,7 +65,7 @@

logger.LogInfo($"Stored Dependabot proxy certificate at {result.CertificatePath}");

result.Certificate = new X509Certificate2(result.CertificatePath);

Check warning on line 68 in csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependabotProxy.cs

View workflow job for this annotation

GitHub Actions / stubgentest

'X509Certificate2.X509Certificate2(string)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https://aka.ms/dotnet-warnings/SYSLIB0057)

Check warning on line 68 in csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependabotProxy.cs

View workflow job for this annotation

GitHub Actions / stubgentest

'X509Certificate2.X509Certificate2(string)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https://aka.ms/dotnet-warnings/SYSLIB0057)

Check warning on line 68 in csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependabotProxy.cs

View workflow job for this annotation

GitHub Actions / CodeQL-Build

'X509Certificate2.X509Certificate2(string)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https://aka.ms/dotnet-warnings/SYSLIB0057)

Check warning on line 68 in csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependabotProxy.cs

View workflow job for this annotation

GitHub Actions / CodeQL-Build

'X509Certificate2.X509Certificate2(string)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https://aka.ms/dotnet-warnings/SYSLIB0057)

Check warning on line 68 in csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependabotProxy.cs

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest)

'X509Certificate2.X509Certificate2(string)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https://aka.ms/dotnet-warnings/SYSLIB0057)

Check warning on line 68 in csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependabotProxy.cs

View workflow job for this annotation

GitHub Actions / unit-tests (windows-2019)

'X509Certificate2.X509Certificate2(string)' is obsolete: 'Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.' (https://aka.ms/dotnet-warnings/SYSLIB0057)
}

return result;
Expand Down
Loading