Repository navigation
Wrap credential data to allow late credential prompting and update NTLM/SSPI to attempt SSPI login prior to prompting for credentials. - #3617
Conversation
…er can be delayed when necessary.
|
Sorry for not getting back to you sooner on this. I've taken a first pass over it, and I hope to give it a more comprehensive look on Tuesday. |
bk2204
left a comment
There was a problem hiding this comment.
Overall, this looks like it's moving in the right direction. I've left some general comments on some style and cleanliness stuff, but it seems generally sane.
It looks like CI has failed, so you'll likely want to investigate why that is and squash in some changes to address the cause of that failure.
|
It appears that the test for lfsapi is timing out after 10 minutes, but I'm not sure how anything I changed could have caused that. I'm not sure how I would even go about debugging the test. I think it might have something to do with the credential prompt and the test now being able to provide anything for the credentials, but I'm not sure how that works. |
|
I recently hit a test timeout as well and it was a hang in the code. Does the test hang when you run |
|
when I do make test integration I get a bunch of \ and then make: *** [lint] Error 1. When I do "go test ./lfsapi" it runs for 10 minutes and then times out. |
|
If you're seeing that failure in The |
|
"make vendor" also fails with an error 1. |
|
Can you provide the actual error output? Are you using a version of Go that's at least 1.11? |
|
Apparently there is a temporary environment variable that I had to set to get vendor to work. GO111MODULE was "auto" and needed to be "on". |
|
But yeah, I know that it's the lfsapi test that's failing. I'm pretty sure it is because the timing of the credential prompt changed and the test execution doesn't provide anything for the input, but I'm not really sure how to make that happen as I don't really understand what the current test is actually doing. |
|
I think the problem is that something is getting called in a loop without making progress. For example, if I apply the following patch and run I'm not sure why this is, but it's definitely the cause of the hang. |
|
So I tracked it down but I don't know go well enough to know what the fix is. It appears the problem is that FillCreds does not end up updating the Creds property correctly. When I call in to FillCreds on auth.go:152, within the method I have the correct creds, but after the function returns, the creds on the object are empty. It appears perhaps it needed a *. Changing that seems to have fixed it to be pass by reference. Now it looks like i just have issues with ntlm_test - TestNtlmAuth and auth_test - TestGetCreds. Both seem to be related to what my initial thoughts were on why it would have issues and now that I see where they are I can probably work it out. |
Oh, yeah, I missed that. Typically you want to make methods use the pointer version in Go (the version with the |
Fix test of NTLM credentials test to test both SSPI and non SSPI cases.
|
Looks like something is still failing with the NTLM test, I hadn't been able to get that one working locally yet either and wasn't 100% clear on what it's doing. I'll do some more digging. It's the actual ntlm_test - TestNtlmAuth that seems to be the problem. |
|
Ok, so I have tracked down the problem. There apparently is not currently any SSPI test suite. Switching the order so that SSPI goes first resulted in unexpected requests to the test server which result in it crashing. I do not have the knowledge to implement an SSPI server side test emulator, so I'm not sure how we want to move forward. Oh wait, it's just keeping count of the request number and faking a response, so I should be able to just provide a failure error for SSPI and get it to advance to the NTLM test. There still won't be an SSPI test suite, but that isn't here already. |
|
That's probably fine for now. If you're interested, there's a good doc that goes into depth about NTLM, should you want to synthesize a test. |
|
I'm not even sure if we could synthesis a good cross platform one since with SSPI the credential is going to be pulled from the active user. We'd be faking it hard to the point of probably being pretty close to no value anyway. |
|
It appears there is now some kind of fault in the ntlm_auth_test_nix, but I'm not able to debug that test as I don't have a *nix environment handy. Any idea what that test is supposed to be doing? |
|
I think that test is supposed to be checking that you can authenticate on Unix. In Go, you can have build commands at the top of the file to control the platform, and the Part of the problem here is that SSPI doesn't work on Unix, because the credentials that are available on Windows won't exist, so the test is failing because it's getting nil credentials, which it doesn't expect. It may be a good idea to wrap the nil credentials code in something like |
|
Yeah, sorry I didn't update earlier, but I figured that out and added a value to the ntlm_auth implementation that is platform specific to indicate if SSPI is available or not. Right now it's just true and false hardcoded, but it's possible it could have more complicated logic to determine in the future. |
|
Well, after updating the NTLM test to respond correctly when skipping the SSPI attempt on *nix, it's now made it past the unit tests. Guess we'll see how the rest of the test suite does. That is quite the set of tests. |
|
Ok, so I think things should be good now. I'm not sure how to make it so that the requested changes are addressed. I updated them in the code, but it seems that I did something wrong process wise for having them flag as clear. I was also able to test this in my local TFS environment and it successfully did a clone of an LFS enabled repo without prompting for a password and succeeded via SSPI. I've got an environment where I can test it with a user whose SSPI credentials will fail too, but it takes a bit. I'll post back when I have completed that test. |
|
And doing a clone of an LFS enabled repository just worked on a machine that is not on a trusted domain using NTLM credentials without going through SSPI as well. |
|
Updated title of pull request now that this is an actual fix for the issue and has been more rigorously developed and tested. |
bk2204
left a comment
There was a problem hiding this comment.
This looks great! Thanks for working on this, and sorry it's taken me so long to get back to you with a final review.
This is very rough at the moment as I just picked up Go and have very little idea about it's structures, so I may be mishandling objects or over-exposing things, but this provides what should be a general framework for encapsulating the information related to credentials and making it so that the Fill can be called later in the process to support things like NTLM SSPI or anything else where an automatic credential should be tried prior to prompting the user, but where we can't take the initial action until after the credential helpers have been setup.
The code builds and the general concept should be sound as far as I can tell, but I can't guarantee anything towards proper function at the moment.
This is an attempt at resolving #3615.