Skip to content

Commit 7369d04

Browse files
committed
C#: Don't initialise DependabotProxy on Windows or macOS
1 parent 2e80e09 commit 7369d04

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependabotProxy.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ public class DependabotProxy : IDisposable
2727

2828
internal static DependabotProxy? GetDependabotProxy(ILogger logger, TemporaryDirectory tempWorkingDirectory)
2929
{
30+
// Setting HTTP(S)_PROXY and SSL_CERT_FILE have no effect on Windows or macOS,
31+
// but we would still end up using the Dependabot proxy to check for feed reachability.
32+
// This would result in us discovering that the feeds are reachable, but `dotnet` would
33+
// fail to connect to them. To prevent this from happening, we do not initialise an
34+
// instance of `DependabotProxy` on those platforms.
35+
if (SystemBuildActions.Instance.IsWindows() || SystemBuildActions.Instance.IsMacOs()) return null;
36+
3037
// Obtain and store the address of the Dependabot proxy, if available.
3138
var host = Environment.GetEnvironmentVariable(EnvironmentVariableNames.ProxyHost);
3239
var port = Environment.GetEnvironmentVariable(EnvironmentVariableNames.ProxyPort);

0 commit comments

Comments
 (0)