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

utils/authority doesn't properly handle userinfo percent-encoding #189

Closed
funkyshu opened this issue Jun 10, 2024 · 0 comments
Closed

utils/authority doesn't properly handle userinfo percent-encoding #189

funkyshu opened this issue Jun 10, 2024 · 0 comments

Comments

@funkyshu
Copy link
Member

Describe the bug
Certain characters like \ are disallowed in raw form in the userinfo section of a URI. They must be percent/url -encoded. However the vfs utility for handing authority does not handle decoding percent/url -encoded values.

To Reproduce
Steps to reproduce the behavior:

uri := `sftp://domain.com%5cuser@host.com:22/`
loc, err := vfssimple.NewLocation(uri)
if err != nil {
	panic(err)
}
fmt.Println(loc.URI())
fmt.Println(loc.(*sftp.Location).Authority.UserInfo().Username())

Expected behavior
loc.URI() should returns the still-encoded uri as expected but the fetch the username should return the decoded value: domain.com\user but it returns domain.com%5Cuser. This will pass the wrong username to the client which fails authentication.

Additional context
This will affect both FTP and SFTP.

funkyshu added a commit that referenced this issue Jun 10, 2024
…/decoding of uri with reserved characters.
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

No branches or pull requests

1 participant