Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Fix SocketsHttpHandler.PreAuthenticate behavior #28047

Merged
merged 4 commits into from
Mar 15, 2018

Conversation

stephentoub
Copy link
Member

Previously PreAuthenticate was causing SocketsHttpHandler to always add a basic auth header on every request if a basic credential could be retrieved from the supplied credentials. This is not how PreAuthenticate is supposed to work. Rather, the handler is supposed to track credentials that have previously been used to successfully authenticate, and then on subsequent requests use credentials from that successfully-authenticated cache.

Closes https://github.com/dotnet/corefx/issues/27597
cc: @geoffkizer, @davidsh, @mconnew

@stephentoub stephentoub force-pushed the preauthsocketshandler branch from db2a86e to 9c00556 Compare March 14, 2018 15:36
{
switch (response.StatusCode)
{
case HttpStatusCode.ProxyAuthenticationRequired:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems too generous -- e.g. do we really want to interpret a 5xx as auth success? My instinct is only 2xx/3xx should be interpreted that way. Not sure what other handlers do here though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be misreading things, but this appears to be what WinHttpHandler does:


I'll add a test for a bunch of different status codes and update it if need be.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a test for a bunch of different status codes and update it if need be.

As we've found previously any time we look at something like this, there are differences between the various handlers.

I tried all of the status codes from 100 to 599....

NetfxHandler treated all of them as success for auth with the exception of

  • Unauthorized (401), as expected, and
  • Continue (100)

WinHttpHandler treated all of them as success for auth, with the exception of:

  • All codes in the range [100, 199]
  • Moved (301)
  • Redirect (302)
  • RedirectMethod (303)
  • TemporaryRedirect (307)
  • PermanentRedirect (308)
  • Unauthorized (401)
  • ProxyAuthenticationRequired (407)

CurlHandler treated all of them as success for auth, with the exception of:

  • Unauthorized (401)

Given this, I think more closely matching NetfxHandler and CurlHandler, i.e. what's in this PR, makes sense. If nothing else, it's the easiest to explain. But, I don't have a strong opinion.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think more closely matching NetfxHandler

Yes, we should match .NET Framework as much as possible. That HTTP stack has been in use for 15+ years and its behaviors are what most devs are expecting when moving to .NET Core.

Debug.Assert(pool.PreAuthCredentials.GetCredential(authUri, NegotiateScheme) == null);
Debug.Assert(pool.PreAuthCredentials.GetCredential(authUri, NtlmScheme) == null);
Debug.Assert(pool.PreAuthCredentials.GetCredential(authUri, DigestScheme) == null);
credential = pool.PreAuthCredentials.GetCredential(authUri, BasicScheme);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little unclear how actually saving off the ICredential and retrieving it here it useful.

It seems like all we're really doing here is remembering that we did successful Basic auth against this particular Uri previously. The credentials should always be the same as if we just retrieved them again from the original Credential, right?

Copy link
Member Author

@stephentoub stephentoub Mar 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

against this particular Uri previously

Not just this particular Uri... the credential cache does prefix matching.

I'll add a test for that as well.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but you're adding specifically adding authUri to the credential cache below. So that would only matter if authUri ends in a '/', is that right? I mean, if I successfully authenticate against '/abc/foo.html' and then another request comes for '/abc/bar.html', that won't trigger preauth, right? I'm just trying to understand the behavior here...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@stephentoub stephentoub Mar 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test:

using System;
using System.Net;

class Program
{
    static void Main()
    {
        var cred = new NetworkCredential("hello", "world");
        var cc = new CredentialCache();
        cc.Add(new Uri("http://bing.com/something/hello.html"), "Basic", cred);

        string[] tests =
        {
            "http://microsoft.com/something/hello.html",
            "http://bing.com/something/hello.html",
            "http://bing.com/something/world.html",
            "http://bing.com/something/",
            "http://bing.com/",
            "http://bing.com/hello.html",
            "http://bing.com/world.html",
            "http://bing.com/another/",
            "http://bing.com/another/hello.html",
            "http://bing.com/somethingelse/",
            "http://bing.com/somethingelse/hello.html",
        };

        foreach (string s in tests)
        {
            Console.WriteLine(s.PadRight(50) + ": " + cc.GetCredential(new Uri(s), "Basic"));
        }
    }
}

produces:

http://microsoft.com/something/hello.html         :
http://bing.com/something/hello.html              : System.Net.NetworkCredential
http://bing.com/something/world.html              : System.Net.NetworkCredential
http://bing.com/something/                        : System.Net.NetworkCredential
http://bing.com/                                  :
http://bing.com/hello.html                        :
http://bing.com/world.html                        :
http://bing.com/another/                          :
http://bing.com/another/hello.html                :
http://bing.com/somethingelse/                    : System.Net.NetworkCredential
http://bing.com/somethingelse/hello.html          : System.Net.NetworkCredential

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, there are similar (but different of course) rules for digest: https://tools.ietf.org/html/rfc7616#section-3.6, https://tools.ietf.org/html/rfc7616#section-3.3 (for definition of "protection space").

Of course for digest, we need to remember some state from previous challenges in order to preauthenticate.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, those results look wacky... but your theory re '/' at least makes them look somewhat sane.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidsh, is this an issue with CredentialCache? It seems like in the line here:

return string.Compare(uri.AbsolutePath, 0, prefixUri.AbsolutePath, 0, prefixLen, StringComparison.OrdinalIgnoreCase) == 0;

prefixLen should maybe be prefixLen + 1?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidsh, is this an issue with CredentialCache?

I'm not sure. We haven't had any bug reports previously about this.

cc: @Tratcher comments?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the somethingelse match looks wrong. That said I haven't seen many users that scope by path, scoping by domain is the primary use case.

If two threads are racing to create the first connection for a specific pool, one of them will end up creating a pool object that's then discarded. Make sure we dispose it.  Right now it doesn't really matter as there aren't any resources in an empty pool that need to be cleaned up, but it's a good measure and will help in the future if that changes.
Previously SocketsHttpHandler.PreAuthenticate was causing SocketsHttpHandler to always add a basic auth header on every request if a basic credential could be retrieved from the supplied credentials.  This is not how PreAuthenticate is supposed to work.  Rather, the handler is supposed to track credentials that have previously been used to successfully authenticate, and then on subsequent requests use credentials from that successfully-authenticated cache.
@stephentoub stephentoub force-pushed the preauthsocketshandler branch from 9c00556 to 9b7de1b Compare March 14, 2018 18:40
{
try
{
pool.PreAuthCredentials.Add(authUri, BasicScheme, challenge.Credential);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memory leak, you never remove entries. HWR had a similar bug where it would add an entry for /a, /a/b, /a/b/c, etc.. We changed it to a LRU list with a max of 100 entries: https://referencesource.microsoft.com/#System/net/System/Net/_PrefixLookup.cs,1464f3b5a82af37f

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you never remove entries

The other .NET Core handlers all use CredentialCache, so this is no worse than those. As noted in https://github.com/dotnet/corefx/issues/28045, we should ideally have a different type anyway that doesn't require taking a giant lock; we can address any such concerns as part of that.

@stephentoub
Copy link
Member Author

@dotnet/dnceng, the Linux leg failed here with this error:
https://ci3.dot.net/job/dotnet_corefx/job/master/job/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/10169/

/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018: The "CreateAzureContainer" task failed unexpectedly. [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018: System.Net.Http.HttpRequestException: Request https://dotnetbuilddrops.blob.core.windows.net/build-6a3e83f717ce4f9bb4e04cd39f89acd0?restype=container failed with status Forbidden. Response : <?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018: RequestId:758f6d05-001e-0026-0aca-bbce75000000 [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018: Time:2018-03-14T19:26:04.2851367Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request '4hmnjdKmeuYL4rNSh5PeL9q59Uyl6bWFV++g6zwg1hE=' is not the same as any computed signature. Server used following string to sign: 'PUT [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:  [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:  [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:  [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:  [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:  [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:  [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:  [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:  [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:  [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:  [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:  [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018: x-ms-date:Wed, 14 Mar 2018 19:26:04 GMT [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018: x-ms-version:2015-04-05 [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018: /dotnetbuilddrops/build-6a3e83f717ce4f9bb4e04cd39f89acd0 [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018: restype:container'.</AuthenticationErrorDetail></Error> [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:    at Microsoft.DotNet.Build.CloudTestTasks.AzureHelper.<RequestWithRetry>d__13.MoveNext() [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018: --- End of stack trace from previous location where exception was thrown --- [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:    at Microsoft.DotNet.Build.CloudTestTasks.CreateAzureContainer.<ExecuteAsync>d__33.MoveNext() [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018: --- End of stack trace from previous location where exception was thrown --- [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:    at Microsoft.DotNet.Build.CloudTestTasks.CreateAzureContainer.Execute() [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() in E:\A\_work\45\s\src\Build\BackEnd\TaskExecutionHost\TaskExecutionHost.cs:line 631 [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]
/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/Tools/CloudTest.Helix.targets(174,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() in E:\A\_work\45\s\src\Build\BackEnd\Components\RequestBuilder\TaskBuilder.cs:line 787 [/mnt/j/workspace/dotnet_corefx/master/linux-TGroup_netcoreapp+CGroup_Release+AGroup_x64+TestOuter_false_prtest/src/upload-tests.proj]

@stephentoub
Copy link
Member Author

And, @dotnet/dnceng, the OSX legs appear to also have failed fairly catastrophically, e.g.
https://ci3.dot.net/job/dotnet_corefx/job/master/job/osx-TGroup_netcoreapp+CGroup_Debug+AGroup_x64+TestOuter_false_prtest/9712/

DownloadError: Unable to download https://dotnetbuilddrops.blob.core.windows.net/build-ac55f63c8f8741c9a3eb272da3a9b2b7/SupplementalPayload.zip?sv=2015-04-05&sr=c&sig=Tcprfi57kLqJO8fCnuJERb%2BYPfPo2MOHG3VXA13fGRA%3D&st=2018-03-14T19%3A15%3A34.1855230Z&se=2018-04-13T19%3A15%3A34.1855440Z&sp=r after retrying. Execution may be compromised.

@jonfortescue
Copy link
Contributor

Oh I think I know what this is. @MattGal is currently cycling our secrets and these look like auth errors. If you are pulling the secrets from KeyVault then this issue will resolve itself shortly. If not, you'll have to manually update secret info.

@MattGal
Copy link
Member

MattGal commented Mar 14, 2018

@jonfortescue is correct, I'm chatting with @mmitche now to see if this transient (there's no good time to unplannedly cycle a storage key) or if we have to fix it in Jenkins.

@MattGal
Copy link
Member

MattGal commented Mar 14, 2018

Not transient, I learned that Jenkins stores its own copy of things (joy), updating now.

@MattGal
Copy link
Member

MattGal commented Mar 14, 2018

@stephentoub this should be fixed now, but I'll keep an eye on it.

@MattGal
Copy link
Member

MattGal commented Mar 14, 2018

@dotnet-bot Test Linux x64 Release Build please

@stephentoub
Copy link
Member Author

Thanks, Matt.

@stephentoub
Copy link
Member Author

@dotnet-bot test OSX x64 Debug Build please
@dotnet-bot test Windows x64 Debug Build please

@stephentoub
Copy link
Member Author

@MattGal, is there still a problem here?

@MattGal
Copy link
Member

MattGal commented Mar 14, 2018

There's backup right now and I'm urgently trying to find @mmitche for a jenkins expert but otherwise I believe the issues that caused this are addressed.

@mmitche
Copy link
Member

mmitche commented Mar 14, 2018

OSX is working fine now

@stephentoub
Copy link
Member Author

What about the Windows and Linux failures... is that just due to a backup?

@MattGal
Copy link
Member

MattGal commented Mar 15, 2018

@stephentoub : All Jenkins stuff should be affected equally due to Jenkins keeping its own copy of secrets i was unaware of. The difference is elastic scale; we can make tons of Linux and Windows machines to match any workload, we have a fixed set of macs.

I believe everything should be fixed, feel free to queue new builds. @mmitche and I did some cleanup for old OSX jobs that may have cancelled some work items for existing ones but OSX is now healthy as well. If you want me to requeue stuff anywhere I see jobs failing i can (I'm skittish as sometimes the bot requeues things I didn't want it to)

@stephentoub
Copy link
Member Author

@dotnet-bot test Linux x64 Release Build please
@dotnet-bot test Windows x64 Debug Build please

@stephentoub
Copy link
Member Author

@dotnet-bot test Windows x64 Debug Build please

1 similar comment
@stephentoub
Copy link
Member Author

@dotnet-bot test Windows x64 Debug Build please

@stephentoub stephentoub merged commit e2ed932 into dotnet:master Mar 15, 2018
@stephentoub stephentoub deleted the preauthsocketshandler branch March 15, 2018 14:46
@karelz karelz added this to the 2.1.0 milestone Mar 18, 2018
ericstj pushed a commit to ericstj/corefx that referenced this pull request Mar 28, 2018
* Use named arguments for more bool arguments

* Dispose of new HttpConnectionPool if we lose race condition

If two threads are racing to create the first connection for a specific pool, one of them will end up creating a pool object that's then discarded. Make sure we dispose it.  Right now it doesn't really matter as there aren't any resources in an empty pool that need to be cleaned up, but it's a good measure and will help in the future if that changes.

* Fix SocketsHttpHandler.PreAuthenticate behavior

Previously SocketsHttpHandler.PreAuthenticate was causing SocketsHttpHandler to always add a basic auth header on every request if a basic credential could be retrieved from the supplied credentials.  This is not how PreAuthenticate is supposed to work.  Rather, the handler is supposed to track credentials that have previously been used to successfully authenticate, and then on subsequent requests use credentials from that successfully-authenticated cache.

* Add more tests
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* Use named arguments for more bool arguments

* Dispose of new HttpConnectionPool if we lose race condition

If two threads are racing to create the first connection for a specific pool, one of them will end up creating a pool object that's then discarded. Make sure we dispose it.  Right now it doesn't really matter as there aren't any resources in an empty pool that need to be cleaned up, but it's a good measure and will help in the future if that changes.

* Fix SocketsHttpHandler.PreAuthenticate behavior

Previously SocketsHttpHandler.PreAuthenticate was causing SocketsHttpHandler to always add a basic auth header on every request if a basic credential could be retrieved from the supplied credentials.  This is not how PreAuthenticate is supposed to work.  Rather, the handler is supposed to track credentials that have previously been used to successfully authenticate, and then on subsequent requests use credentials from that successfully-authenticated cache.

* Add more tests


Commit migrated from dotnet/corefx@e2ed932
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants