Skip to content

GetResponseWithRedirects only adds credentials to cache for matching schemes #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

dylanlerch
Copy link

@dylanlerch dylanlerch commented Jul 12, 2021

The previous implementation of ManagedHttpSmartSubtransportStream.GetResponseWithRedirects was not checking that the scheme matched the provided credentials before adding to the credential cache (instead defaulting to the scheme of the first value in the WWW-Authenticate header).

That could cause issues in some cases where the first challenge contained an unsupported scheme (such as Bearer). In this case, the old implemenation would add the credentials to the cache with Bearer scheme - regardless of the credential type - and all additional (potentially valid) schemes in the header would be discarded.

Credentials are now added to the cache for every supported scheme that matches the given credential type. This new implementation copies the one used in the libgit2 library; default credentials are used for the Negotiate scheme, username/password credentials are used for the NTLM and Basic schemes, and all others are ignored.

The error in the current implementation can be reproduced when attempting to connect to a repository in an Azure AD-backed Azure DevOps organisation.

…g schemes

The previous implementation of `ManagedHttpSmartSubtransportStream.GetResponseWithRedirects` was not checking that the scheme matched the provided credentials before adding to the credential cache (instead defaulting to the scheme of the first value in the WWW-Authenticate header).

That could cause issues in some cases where the first challenge contained an unsupported scheme (such as Bearer). In this case, the old implemenation would add the credentials to the cache with Bearer scheme - regardless of the credential type - and all additional (potentially valid) schemes in the header would be discarded.

Credentials are now added to the cache for every supported scheme that matches the given credential type.

The new implementation copies the one used in the libgit2 library: Default credentials are used for the Negotiate scheme, username/password credentials are used for the NTLM and Basic schemes, and all others are ignored.

The error in the current implementation can be reproduced when attempting to connect to a repository in an Azure AD-backed Azure DevOps organisation.
@dylanlerch dylanlerch force-pushed the dylan/credential-schemes branch from 49112be to 0eb7b94 Compare July 12, 2021 23:47
@dylanlerch dylanlerch changed the base branch from master to octopus/master July 13, 2021 01:07
@dylanlerch dylanlerch changed the base branch from octopus/master to master July 13, 2021 01:08
@dylanlerch
Copy link
Author

No longer necessary, master now uses the LibGit2 transport

@dylanlerch dylanlerch closed this Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant