Skip to content
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

Fix bug in Windows credential manager credential matching on port numbers #748

Merged
merged 1 commit into from
Jun 17, 2022

Conversation

mjcheetham
Copy link
Collaborator

Fix a bug whereby we would not correctly match existing credentials when port numbers were used in the search. Additionally, actually now store the non-default port number in the target URI if there is one given.

Fixes #747

@ldennington ldennington changed the title Fix bug in Windows credential manager credential matching on port numberss Fix bug in Windows credential manager credential matching on port numbers Jun 16, 2022
Fix a bug whereby we would not correctly match existing credentials when
port numbers were used in the search. Additionally, actually now store
the non-default port number in the target URI if there is one given.

We also now always trim any trailing '/' from the end of the path of a
service/target URI. Previously we erronously only trimmed the '/' from a
'pathless' URI, i.e.:

  https://example.com/      => https://example.com
  https://example.com/path/ => https://example.com/path/

This is a safe change since the `Enumerate` method that is used by both
`Get` and `Remove` already matches _both_ trailing and non-trailing
slashes by virtue of creating and comparing components of a `System.Uri`
which does normalisation of the path.

Both `Get` and `Remove` would act (eventually) to remove any bad
credentials stored with a trailing slash, even if new credentials are
only written out without the slash.
Copy link
Contributor

@ldennington ldennington left a comment

Choose a reason for hiding this comment

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

Ran through on my Windows machine - looks great 🌟.

@ldennington ldennington merged commit 97495b3 into git-ecosystem:main Jun 17, 2022
@mjcheetham mjcheetham deleted the wincred-fix branch June 20, 2022 14:53
@ldennington ldennington mentioned this pull request Jun 20, 2022
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.

[bug] Reversed logic in WindowsCredentialManager for matching port number
2 participants