openssh-rust / openssh

Scriptable SSH through OpenSSH in Rust
Apache License 2.0
232 stars 35 forks source link

Use rfind to locate the @ in connection string #139

Closed tomas789 closed 8 months ago

tomas789 commented 8 months ago

Our counterparty uses email addresses as usernames. The connection string looks something like

ssh://john.doe@example.com:johnspassword@sftp-transparency.entsoe.eu

The resolve function looks for the @ when parsing the URL using find function. That finds the first @ which means the username is john.doe instead of john.doe@example.com. Using rfind instead resolves this issue. I'm not sure if this is valid according to the URL standard. It should not break any existing existing functionality as the hostname seems to not allow @ sign.

Perhaps a better approach would be to rely on an external crate for this. The url crate comes to mind.

jonhoo commented 8 months ago

This change is Reviewable

NobodyXu commented 8 months ago

Looks like we need to bump MSRV

NobodyXu commented 8 months ago

Given that all CI runs except for these two which runs cargo +nightly -Zminimal-version failed, it's probably a bug in getrandom v0.1.7