Skip to content

Commit fc067e8

Browse files
committed
generic: support GCM_ALLOW_UNSAFE_REMOTES option
Note that we only emit a warning for the generic host provider rather than failing-fast like the other providers do. This is because we never blocked HTTP remotes previously in the generic provider (which is often used for localhost, custom hosts, etc) and don't want to break any existing scenarios or scripts. The new option can be used to dismiss this warning message.
1 parent 7a613f3 commit fc067e8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/shared/Core/GenericHostProvider.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ public override async Task<ICredential> GenerateCredentialAsync(InputArguments i
5454
{
5555
ThrowIfDisposed();
5656

57+
// We only want to *warn* about HTTP remotes for the generic provider because it supports all protocols
58+
// and, historically, we never blocked HTTP remotes in this provider.
59+
// The user can always set the 'GCM_ALLOW_UNSAFE' setting to silence the warning.
60+
if (!Context.Settings.AllowUnsafeRemotes &&
61+
StringComparer.OrdinalIgnoreCase.Equals(input.Protocol, "http"))
62+
{
63+
Context.Streams.Error.WriteLine(
64+
"warning: use of unencrypted HTTP remote URLs is not recommended; " +
65+
$"see {Constants.HelpUrls.GcmUnsafeRemotes} for more information.");
66+
}
67+
5768
Uri uri = input.GetRemoteUri();
5869

5970
// Determine the if the host supports Windows Integration Authentication (WIA) or OAuth

0 commit comments

Comments
 (0)